You are here: PHP error on form « PHP « IT news, forums, messages
PHP error on form

Posted by Bruce Gilbert on 11/14/68 11:22

Hello,

I am trying to get a form to work integrating html with PHP.

the code I have is:

<?
$form_block = "
<FORM METHOD=\"POST\" ACTION=\"$PHP_SELF\">
<p><strong>Your Name:</strong>< /br>
<INPUT type=\"text\" NAME=\"senders_name\" SIZE=30></p>
<p><strong><p><Your E-mail Address:</strong>< /br>
<INPUT type=\"text\" NAME=\"senders_email\" SIZE=30></p>
<p><strong>Message:</strong>< /br>
<TEXTAREA NAME=\"message\" COLS=30 ROWS=5 WRAP=virtual></TEXTAREA></p>
<INPUT type=\"hidden\" name=\"op\" value=\"ds\">
<p><INPUT TYPE=\"submit\" NAME=\"submit\" VALUE=\"Send this Form\"></p>
</FORM>";

if ($_POST['op'] !="ds") {
// they need to see the form
echo "$form_block";
} else if ($_POST['op'] =="ds") {
//check value of $_POST['sender name']
if ($_POST['sender_name'] =="") {
$name_err = "<font color=red>Please enter your name!</font>< /br>";
$send ="no";
}
//check value of $_POST['sender_email']
if ($POST['sender_email'] =="") {
$email_err ="<font color=red>Please enter your email address!</font>< /br>";
$send= "no";
}
//check value of $_POST['message']
if ($POST['message'] =="") {
$message_err = "<font color=red>Please enter a message!</font>< /br>";
$send ="no";
}
if ($send !="no") {
//it's o.k to send, so build the mail
$msg ="E-MAIL SENT FROM WWW SITE\n";
$msg .="Senders Name: $POST['senders_name']\n";
$msg .="Senders E-MAIL: $POST['senders_email']\n";
$msg .="Senders Name: $POST['message']\n\n";
$to ="webguync@gmail.com";
$subject = "There has been a disturbance in the Force";
$mailheaders .="Reply-To: $_POST['sender_email']\n";
//send the mail
mail ($to, $subject, $msg, $mailheaders);
//display confirmation to user
echo "<p>mail has been sent!</p>";
} else if ($send =="no") {
//print error messages
echo "$name_err";
echo "$email_err";
echo "$message_err";
echo "$form_block";
}
}
?>

and the error I get is:

Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE,
expecting T_STRING or T_VARIABLE or T_NUM_STRING in
/hsphere/local/home/bruceg/inspired-evolution.com/Contact_Form_test.php
on line 58

the above code is just the php form part of the page not the entire
code, so it would be impossible to determine line 58, but I was hoping
someone would be able to spot the problem or at least explain the
error to a relative newbie.

thanks

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация