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.";
}
?>
fopen() security
As i understood the usage of fopen() for it to function correctly the Dir you write to has to be rw enabled for the php group, so that fopen() can acces the Dir to write to it. When I try to write
foreach loop, assistance request
I would like some guidance on the usage of foreach as I try to parse through a large database and whittle down to a few select stocks. I'm currently doing this with vb, but I'm wanting to get it
Data storage spaces in varchar2
Trying to understand what's happening.
PHP XML extraction text
I would like to extract an xml text and have that text directly echo(print) out on my web page. Here's the xml i want to extract:http://dblp.uni-trier.de/search/author?xauthor=SchekWhat I
Required to login help
I'm trying to set up my site so users have to be logged into the forum to access the site.I've been working with this bit of codeCode: [Select]<?phpwriteLog();if
Sending an SMS Message with ASP.NET
Often times it may be a requirement for your web application to send an SMS message. Such examples would be reminders, password resetting, and spam.Q: Can I have some code to send an SMS message?A:
sql problems
I am having a small problem with my sql statement. it is inserting into 4 of the fields. fields it is inserting into:FirstLastemailpasswordit is saying the record has been added. is there something
Creating an invoice
Using fpdf I am trying to create an invoice to send to clients. The products are sold in pricing tiers.I've got it working so it only displays a tier if the quantity is greater than 0 but I end up
foreach and array need help combining
Hi guys.Here's the codeCode: array( 'tag' => 'code', 'type' => 'unparsed_content', 'content' => '<div
PHP code needed to get/post form fields and request mysql query results.
I'm new to PHP I've created an html form to allow the user to request a basic telephone directory listing. They can select their 'listtype' by 'all' or by 'state'. If they choose 'state' then they