need help with email script unexpect t_string error
Posted: Fri Dec 01, 2006 4:58 pm
Everah | Please use
Everah | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
the code should be correct. When I try and view the page this script is on 1) my html that is not part of this script does not load 2) the script doesn't load and i get an error that says unexpected t_String error
it says there is a problem with this line
else if ($_POST[x] == "y") {Code: Select all
<?
error_reporting(E_ALL);
$form_block= "
<form action=\"$_SERVER['PHP_SELF']\" method=\"post\">
<table border=0 align=center>
<tr>
<td align=left>
<p>First Name*: <input type=\"text\" name=\"firstname\" size=30 maxlength=25></p>
</td>
<tr>
<td align=left>
<p>Last Name*: <input type=\"text\" name=\"lastname\" size=30 maxlength=25></p>
</td>
</tr>
<tr>
<td align=left>
<p>Email address*: <input type=\"text\" name=\"email\" size=27 maxlength=25></p>
</td>
</tr>
<tr>
<td align=center>
<textarea rows=15 cols=45 name=\"commentsorquestions\">
Please include any comments or questions here.*
</textarea>
</td>
</tr>
<tr>
<td align=center>
<input type=\"hidden\" name=\"x\" value=\"y\">
<p><input type=\"submit\" value=\"Send\">
<input type=\"reset\" value=\"Clear\"></p></td>
</tr>
<tr>
<td align=left>*Indicates required field
</td>
</tr>
</table>
</form>";
if ($_POST['x'] != "y") {
echo "$form_block";
}
else if ($_POST['x'] == "y") {
if (($_POST['firstname'] == "") || ($_POST['lastname'] == "") || ($_POST['email'] == "") || ($_POST['commentsorquestions'] == "")){
// a field is not filled in
$field_err = "<font color=red>Please fill in all required fields!</font>";
$send = "no";
}
}
if ($send != "no"){
$to = "";
$subject = "Feedback";
$mailheaders = "From: My Web site <> \n";
$msg .= "Sender's First Name: $_POST[firstname]\n";
$msg .= "Sender's Last Name: $_POST[lastname]\n";
$msg .= "Email: $_POST[email]\n";
$msg .= "Message: $_POST[commentsorquestions]\n";
mail($to, $subject, $msg);
echo "<P>Your message has been sent. Thank you for your feedback.<P>";
}
else if ($send == "no") {
echo "$field_err";
echo "$form_block";
}
?>
</body>
</html>Everah | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]