ch8dy2 Posted June 6, 2011 Share Posted June 6, 2011 This code is for my websites email form. Have checked all ID's for Caps etc all labels and names are exactly the same yet when i open it after putting it in my host directory and viewing the page i am greeted by this "Parse error: syntax error, unexpected '{' in /home/a5577622/public_html/contactformprocess.php on line 25" Here is the code Guys.(contactformprocess is the saved title of the doc and i have removed the email address for displaying it on here, anything to reduce spammers.) <?php /* Subject and email variables */ $emailSubject = 'contactformprocess!'; $webMaster = ''; /* Gathering data variables */ $nameField = $_POST['name']; $telephoneField = $_POST['telephone']; $optionField = $_POST['option']; $commentsField = $_POST['comments']; $body = <<<EOD <br><hr><br> Email: $name <br> Telephone: $telephone <br> Option: $option <br> $comments: $comments <br> EOD; $headers = "From: $name\r\n"; $headers .= "Content-type: text/html\r\n"; $success = mail {$webMaster, $emailSubject, $body, $headers}; $theResults = <<<EOD <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Message Sent</title> </head> <body> <div align="center"> <p><strong>Thank you for your interest! Your email will be answered very soon </strong></p> <p>You shall be returned to the previous page in just a few soconds</p> </div> </body> </html> EOD; echo "$theResults"; ?> Please help guys, any comments or thoughts a re appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/238581-cant-find-error-but-there-is-one-apparently-please-help/ Share on other sites More sharing options...
Pikachu2000 Posted June 6, 2011 Share Posted June 6, 2011 This is line 25: $success = mail {$webMaster, $emailSubject, $body, $headers}; Considering the error message, do you see the problem there? Quote Link to comment https://forums.phpfreaks.com/topic/238581-cant-find-error-but-there-is-one-apparently-please-help/#findComment-1226033 Share on other sites More sharing options...
Maq Posted June 6, 2011 Share Posted June 6, 2011 In the future, please place tags around your code. Read the stickies and rules next time! Quote Link to comment https://forums.phpfreaks.com/topic/238581-cant-find-error-but-there-is-one-apparently-please-help/#findComment-1226034 Share on other sites More sharing options...
ch8dy2 Posted June 6, 2011 Author Share Posted June 6, 2011 Sorry abou missing out the tags, wont happen again. And Pikachu, im sorry but i really cant see the problem, i have tried a few things but nothing seems to work? Quote Link to comment https://forums.phpfreaks.com/topic/238581-cant-find-error-but-there-is-one-apparently-please-help/#findComment-1226035 Share on other sites More sharing options...
kenrbnsn Posted June 6, 2011 Share Posted June 6, 2011 Parameters passed to functions are enclosed in parentheses "( )", not curly brackets "{ }". Ken Quote Link to comment https://forums.phpfreaks.com/topic/238581-cant-find-error-but-there-is-one-apparently-please-help/#findComment-1226036 Share on other sites More sharing options...
Pikachu2000 Posted June 6, 2011 Share Posted June 6, 2011 mail(), not mail{} Quote Link to comment https://forums.phpfreaks.com/topic/238581-cant-find-error-but-there-is-one-apparently-please-help/#findComment-1226037 Share on other sites More sharing options...
ch8dy2 Posted June 6, 2011 Author Share Posted June 6, 2011 Thankyou Guys! cant believe i missed that! Thanks again Quote Link to comment https://forums.phpfreaks.com/topic/238581-cant-find-error-but-there-is-one-apparently-please-help/#findComment-1226041 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.