rmindigo Posted December 18, 2012 Share Posted December 18, 2012 Getting the following error message: Parse error: syntax error, unexpected $end in /Applications/XAMPP/xamppfiles/htdocs/Testsite/emailto.php on line 3 Here is the code: <form method="post" action=""> <table border="1" width="25%"> <tr> <td width="10">To:</td><td><input type="text" name="to" size="20" value="<?php echo $_REQUEST['emails'];?>"></td></tr> <td width="10">Subject:</td><td><input type="text" name="subject" size="20"></td></tr> <tr> <td width="10">Message:</td><td><textarea name="message" cols="30" rows="3"></textarea> </tr> </table> <p><input type="submit" name="submit" value="send email"><p> </form> <?php if(isset($_REQUEST['submit'])){ $to = $_REQUEST['to']; $subject = $_REQUEST['subject']; $body = $_REQUEST['message']; $from = "admin@ryantutorials.com"; $headers = "From: $from"; if($to && $subject && $body){ mail($to,$subject,$body,$headers); echo "your email has been sent"; header("Refresh:5; url=update.php"); }else{ echo "Please fill out all fields"; } ?> Link to comment https://forums.phpfreaks.com/topic/272156-unexpected-syntax-error/ Share on other sites More sharing options...
Jessica Posted December 19, 2012 Share Posted December 19, 2012 1. Use code tags 2. You're missing a closing }. Link to comment https://forums.phpfreaks.com/topic/272156-unexpected-syntax-error/#findComment-1400206 Share on other sites More sharing options...
drewdan Posted December 19, 2012 Share Posted December 19, 2012 Jessica is quite right, you are missing a closing }. If you indent your code, it will make it easier to see when you have opened a { and then closed it }. This is a common mistake for me when using if statements. Welcome to the Forum! Link to comment https://forums.phpfreaks.com/topic/272156-unexpected-syntax-error/#findComment-1400250 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.