Need help with unexpected T-STRING error
Posted on
16th Feb 2014 07:03 pm by
admin
I'm a newbie and I'm still learning PHP. However this error has me stumped. I've googled, searched the forums, but I can't seem to fix this. I'm sure the fix is obvious, but I so new I really need help. Thanks.
Parse error: syntax error, unexpected T_STRING in /public_html/send.php on line 4
Code: <?php
error_reporting(E_ALL);
function valid_email($str)
{
return ( ! preg_match("/^([a-z0-9+_-]+)(.[a-z0-9+_-]+)*@([a-z0-9-]+.)+[a-z]{2,6}$/ix", $str)) ? FALSE : TRUE;
}
if($_POST['subject']!=""){
echo 'Dirty Spammer! Your message was NOT sent.';
} else {
if( isset($_POST['firstName']) && isset($_POST['lastName']) && isset($_POST['Email']) && valid_email($_POST['Email'])==TRUE && isset($_POST['message']) && strlen($_POST['message'])>15)
{
$to = 'contact@mikemanormusic.com';
$headers = 'From: '.$_POST['Email'].''. "rn" .
'Reply-To: '.$_POST['Email'].'' . "rn" .
'X-Mailer: PHP/' . phpversion();
$subject = "Your Simple AJAX Contact Form";
$message = htmlspecialchars($_POST['message']);
$spam = $_POST['subject'];
if(mail($to, $subject, $message, $headers))
{//we show the good guy only in one case and the bad one for the rest.
echo 'Thank you '.$_POST['firstName'].'. Your message was sent.';
echo '<noscript> <a href="http://www.yourdomain.com">Back to yourdomain.com</a></noscript>';
}
else {
echo "Message not sent.";
echo "Please make sure you're not running this on localhost and also that you are allowed to run mail() function from your webserver.";
}
}
else {
echo "Please make sure you filled in all the required fields, that you entered a valid email and also that your message contains more then 15 characters.";
echo "<noscript> Use your browser's back button or <a href="http://www.yourdomain.com">click here</a></noscript> to try again.";
}
?>
No comments posted yet
Your Answer:
Login to answer
147
44
Other forums
This must be easy , pulling the last record of the day, every day, from a txt
I have a txt file logging weather data every minutes (so 1 record per minute). I want to extract the
Taking an HTML form and a PHP program and making it into one working file.
Hello,
So I would like to display everything INSIDE a specific directory. In other words, I
Where do I put CRON code
So I've figured out alot about how to automatically run a php function. I can't figure out where to
Cron Job and Output
I have php codes running under a cron job.
But everytime i output (echo) , it comes out as comple
Strange array issue, never happened before.
mysql_fetch_array returns 1 array per call. Generally that's why it is inserted into a while statem
set xml path in flash when xml created in memorystream and webrequest
i am creating an xml file using memory stream and i want to load this xml file into the flash on cli
form submit at godaddy?
Trying to test form submission at GoDaddy and it does not seem to work. Here's the page...
h
random generation
hi
i need help with generating this
numbers from 1-12
i want to generate in ran
Two warning messages
Quote<b>Warning</b>: mysql_real_escape_string() expects parameter 1 to
Place specific image in html page when specific name is typed.
Hello,
Fairly new to PHP and was curious if someone might know how to solve a fairly simple r