m1k3yb0y Posted June 6, 2012 Share Posted June 6, 2012 Hey guys! Since my previous post, I got me some new and better hosting for my website. Now I am getting my simple contact form set up on it....and...well, when I submit my contact info, I get a 500 Internal Server error which my browser think it is so it shows its own version of the error. I looked at my error log and this is what it came up with: "PHP Parse error: syntax error, unexpected '}' in /var/www/contact0.php on line 662, referer: http://www.mikeytatelive.com/contactform.php" Anybody know how to fix that problem? Thanks in advance! Quote Link to comment https://forums.phpfreaks.com/topic/263779-php-parse-error-syntax-error/ Share on other sites More sharing options...
Pikachu2000 Posted June 6, 2012 Share Posted June 6, 2012 Usually means you missed a closing quote, or line terminating semicolon. Does your editor support syntax highlighting and brace matching? Quote Link to comment https://forums.phpfreaks.com/topic/263779-php-parse-error-syntax-error/#findComment-1351735 Share on other sites More sharing options...
m1k3yb0y Posted June 7, 2012 Author Share Posted June 7, 2012 yep it does syntax highlighting for all sorts of coding things like php for instance. however, it doesn't do brace matching. Quote Link to comment https://forums.phpfreaks.com/topic/263779-php-parse-error-syntax-error/#findComment-1351880 Share on other sites More sharing options...
Maq Posted June 7, 2012 Share Posted June 7, 2012 Post the pertinent code. Quote Link to comment https://forums.phpfreaks.com/topic/263779-php-parse-error-syntax-error/#findComment-1351889 Share on other sites More sharing options...
m1k3yb0y Posted June 7, 2012 Author Share Posted June 7, 2012 <title>Contact Mikey Tate - MikeyTateLive.com</title> <html> <body bgcolor="333333" text="FFFFFF"> <div id="wrapper"> <div id="pictureWrapper"> <p align="center"> <font size="55">Mikey’s World </font> </p><br/><br/><br/> </div> <div id="maincontent"> <h2>Not quite ready yet!</h2> <p> $field_name = $_POST['cf_name']; $field_email = $_POST['cf_email']; $field_message = $_POST['cf_message']; $mail_to = 'tate.mikey@gmail.com'; $subject = 'New Message from ' . $field_name; $body_message = 'The following person, '.$field_name."has sent you a message via your contact form on MikeyTateLive.com. \n"; $body_message .= 'The message reads: '"\n".$field_message."\n"; $body_message .= 'Here is the sender’s email address in case if you would like to reply to him/her: '.$field_message; $headers = "From: $cf_email\r\n"; $headers .= "Reply-To: $cf_email\r\n"; $mail_status = mail($mail_to, $subject, $body_message, $headers); if ($mail_status) { ?> <script language="javascript" type="text/javascript"> // Print a message alert('Your message has been sent. Thank you! I will contact you soon.'); // Redirect to some page of the site. You can also specify full URL, e.g. http://template-help.com window.location = 'http://www.mikeytatelive.com/'; </script> <?php } //this is where the error comes from else { ?> <script language="javascript" type="text/javascript"> // Print a message alert('I am sorry. Your message could not be sent. Please try again.'); // Redirect to some page of the site. You can also specify full URL, e.g. http://template-help.com window.location = 'http://www.mikeytatelive.com/'; </script> <?php }?> </p> </div> <div id="footer"> <p align="Center">©<?php echo date('Y');?> MikeyTateLive Productions Inc.<br/> <?php echo date('D, F d, Y - h:i:sa');?><br/> Timezone is UTC-1 Greenwich Time</p> </div> </div> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/263779-php-parse-error-syntax-error/#findComment-1351904 Share on other sites More sharing options...
Maq Posted June 7, 2012 Share Posted June 7, 2012 You don't have an opening PHP tag <?php. Quote Link to comment https://forums.phpfreaks.com/topic/263779-php-parse-error-syntax-error/#findComment-1351915 Share on other sites More sharing options...
m1k3yb0y Posted June 13, 2012 Author Share Posted June 13, 2012 sorry for lack of response, but I am such a noob at php. I forgot the opening tag like what Maq said. Anyway, after a few minor adjustments, it works now. Thanks guys! Quote Link to comment https://forums.phpfreaks.com/topic/263779-php-parse-error-syntax-error/#findComment-1353549 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.