ralitza
02-25-2006, 06:49 PM
http://www.iankovi.com/sponsicontact.php
I get Parse error: parse error, unexpected T_ELSE in /home/iankovi/public_html/sponsicontact.php on line 38
<?php
$to = 'iankovi.com';
$name = trim($_POST['name']);
$email = trim($_POST['email']);
$subject = trim($_POST['subject']);
$message = trim($_POST['message']);
$message = wordwrap($message, 85);
if (empty($name) || empty($email) || empty($subject) ||empty($message))
{
echo 'Please fill in and verify all fileds';
if(preg_match("/^[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,6}$/i", $_POST['email']))
{
echo 'Please enter a valid email address.';
} else {
$send=mail("$to", "$email", "$subject", "message");
if($send)
{
echo 'Your message has been sent successfully! A Sponsi representive will get back to you shortly.';
} else {
echo 'There was an error sending the mail, please go back and try again.';
} else {
echo ('
<div id=\"contactleft\">
<h2>Contact customer service</h2>
<span class=\"elevensize\">All fields should be filled in and verified</span>
<form method=\"POST\">
Name: <br />
<input name=\"name\" type=\"text\" class=\"inputlong\" /> <br />
Email Address: <br />
<input name=\"email\" type=\"text\" class=\"inputlong\" /> <br />
Subject: <br />
<input name=\"subject\" type=\"text\" class=\"inputlong\" /> <br />
Detailed Message: <br />
<textarea name=\"message\" cols=\"5\" rows=\"10\" class=\"texarealong\"></textarea>
<br />
<input name=\"send\" type=\"submit\" id=\"contantbutton\" value=\"Send Message\" />
</form>
</div>
');
}
?>
I have another question what should I add to display $name in form rather then 'Nobody' or 'Unknown.' Maybe something to do with headers?
Thanks!
I get Parse error: parse error, unexpected T_ELSE in /home/iankovi/public_html/sponsicontact.php on line 38
<?php
$to = 'iankovi.com';
$name = trim($_POST['name']);
$email = trim($_POST['email']);
$subject = trim($_POST['subject']);
$message = trim($_POST['message']);
$message = wordwrap($message, 85);
if (empty($name) || empty($email) || empty($subject) ||empty($message))
{
echo 'Please fill in and verify all fileds';
if(preg_match("/^[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,6}$/i", $_POST['email']))
{
echo 'Please enter a valid email address.';
} else {
$send=mail("$to", "$email", "$subject", "message");
if($send)
{
echo 'Your message has been sent successfully! A Sponsi representive will get back to you shortly.';
} else {
echo 'There was an error sending the mail, please go back and try again.';
} else {
echo ('
<div id=\"contactleft\">
<h2>Contact customer service</h2>
<span class=\"elevensize\">All fields should be filled in and verified</span>
<form method=\"POST\">
Name: <br />
<input name=\"name\" type=\"text\" class=\"inputlong\" /> <br />
Email Address: <br />
<input name=\"email\" type=\"text\" class=\"inputlong\" /> <br />
Subject: <br />
<input name=\"subject\" type=\"text\" class=\"inputlong\" /> <br />
Detailed Message: <br />
<textarea name=\"message\" cols=\"5\" rows=\"10\" class=\"texarealong\"></textarea>
<br />
<input name=\"send\" type=\"submit\" id=\"contantbutton\" value=\"Send Message\" />
</form>
</div>
');
}
?>
I have another question what should I add to display $name in form rather then 'Nobody' or 'Unknown.' Maybe something to do with headers?
Thanks!