atnixon Posted September 23, 2008 Share Posted September 23, 2008 Hello folks.. Am new to php, and i am trying to get a feedback form submission working from my website. Here is the basic sendmail.php code. <?php $title = $_REQUEST['title']; $name = $_REQUEST['name']; $street = $_REQUEST['nstreet']; $zip = $_REQUEST['zip']; $city = $_REQUEST['city']; $country = $_REQUEST['country']; $phone = $_REQUEST['phone']; $email = $_REQUEST['email']; $website = $_REQUEST['website']; $subject = $_REQUEST['subject']; $reply = $_REQUEST['reply']; $message = "The Feedback Form From: $email Title: $title First Name: $name Street: $street, Zip: $zip City: $city Country: $country Phone: $phone Email: $email Website: $website mail( "[email protected]", "Feedback Form Results", $message "From: $email" ); header( "Location: http://www.blogs.com/Thankyou.html" ); ?> Upon submitting the feedback form, i am getting the following error.. Parse error: syntax error, unexpected T_STRING in D:\Inetpub\Vhosts\aztecwebdesign.co.uk\httpdocs\sendmail.php on line 25 Line 25 in the php code is mail( "[email protected]", "Feedback Form Results", $message "From: $email" ); Can anyone help me please? also, am i doing this completely wrong? Regards... Link to comment https://forums.phpfreaks.com/topic/125458-solved-sendmailphp-help/ Share on other sites More sharing options...
trq Posted September 23, 2008 Share Posted September 23, 2008 You forgot to close the string on line 23. Link to comment https://forums.phpfreaks.com/topic/125458-solved-sendmailphp-help/#findComment-648570 Share on other sites More sharing options...
atnixon Posted September 23, 2008 Author Share Posted September 23, 2008 Sorry for being new, lol, but, what do you mean, close the string? Thanks for responding... Link to comment https://forums.phpfreaks.com/topic/125458-solved-sendmailphp-help/#findComment-648573 Share on other sites More sharing options...
radalin Posted September 23, 2008 Share Posted September 23, 2008 you have declared $message = " then written some string and did not put the closing ". As variable declartion are like $foo = "blahblah"; You should also add a semicolon after double quote. Link to comment https://forums.phpfreaks.com/topic/125458-solved-sendmailphp-help/#findComment-648602 Share on other sites More sharing options...
atnixon Posted September 23, 2008 Author Share Posted September 23, 2008 you have declared $message = " then written some string and did not put the closing ". As variable declartion are like $foo = "blahblah"; You should also add a semicolon after double quote. Thank you so much for explain that too me. Works a treat... Link to comment https://forums.phpfreaks.com/topic/125458-solved-sendmailphp-help/#findComment-648606 Share on other sites More sharing options...
jonsjava Posted September 23, 2008 Share Posted September 23, 2008 added a feature that will tell you if it fails sending the e-mail: <?php $title = $_REQUEST['title']; $name = $_REQUEST['name']; $street = $_REQUEST['nstreet']; $zip = $_REQUEST['zip']; $city = $_REQUEST['city']; $country = $_REQUEST['country']; $phone = $_REQUEST['phone']; $email = $_REQUEST['email']; $website = $_REQUEST['website']; $subject = $_REQUEST['subject']; $reply = $_REQUEST['reply']; $message = "The Feedback Form\n From: $email \n Title: $title\n First Name: $name \n Street: $street, \n Zip: $zip \n City: $city \n Country: $country \n Phone: $phone\n Email: $email\n Website: $website"; if (mail( "[email protected]", "Feedback Form Results", $message, "From: $email" )){ header( "Location: http://www.blogs.com/Thankyou.html" ); } else{ echo "There was an error sending your message. Please contact the site Administrator."; } ?> You were willing to do the work, instead of asking for us to write it for you, so I figured I'd go the extra mile. Link to comment https://forums.phpfreaks.com/topic/125458-solved-sendmailphp-help/#findComment-648608 Share on other sites More sharing options...
atnixon Posted September 23, 2008 Author Share Posted September 23, 2008 added a feature that will tell you if it fails sending the e-mail: <?php $title = $_REQUEST['title']; $name = $_REQUEST['name']; $street = $_REQUEST['nstreet']; $zip = $_REQUEST['zip']; $city = $_REQUEST['city']; $country = $_REQUEST['country']; $phone = $_REQUEST['phone']; $email = $_REQUEST['email']; $website = $_REQUEST['website']; $subject = $_REQUEST['subject']; $reply = $_REQUEST['reply']; $message = "The Feedback Form\n From: $email \n Title: $title\n First Name: $name \n Street: $street, \n Zip: $zip \n City: $city \n Country: $country \n Phone: $phone\n Email: $email\n Website: $website"; if (mail( "[email protected]", "Feedback Form Results", $message, "From: $email" )){ header( "Location: http://www.blogs.com/Thankyou.html" ); } else{ echo "There was an error sending your message. Please contact the site Administrator."; } ?> You were willing to do the work, instead of asking for us to write it for you, so I figured I'd go the extra mile. WOW...thank you very much indeed..I'll tag that to my php now. Yes, i prefer to do the work myself if i can, i find that its the best way to learn..well, works for me anyways...he he he I cant believe it was something as simple as the quotation mark missing. Thanks for the help everyone. Link to comment https://forums.phpfreaks.com/topic/125458-solved-sendmailphp-help/#findComment-648611 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.