chris_rulez001 Posted July 3, 2007 Share Posted July 3, 2007 hi ive made a mail sender and its not working it is saying: Parse error: syntax error, unexpected T_IF in /home/www/hostsareus.awardspace.co.uk/mail.php on line 6 contactus.php: <?php session_start() ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>- Contact Us</title> <link rel="stylesheet" href="css/stylesheet.css" /> <?php include ('includes/mysql_connect_users.php'); include ('includes/general.php'); ?> </head> <body> <table width="86%" border="0" align="center"> <tr> <td height="26" class="headerback"><?php echo $site_name; ?></td> </tr> <tr> <td class="topnav" height="5"><a href="index.php">Home</a> | <a href="terms.php">Terms</a> | <a href="faq.php">FAQ</a> | <a href="contactus.php">Contact Us</a> | <a href="upload.php">Upload</a> <?php if (!isset($_SESSION['username']) == false) echo "| <a href='logout.php'>Logout</a> "; else{ echo "| <a href='login.php'>Login</a> | <a href='register.php'>Register</a> "; }?></td> </tr> <tr> <td class="siteback"><div align='center'><form action='mail.php' method='post' enctype='multipart/form-data'> <p> </p> <p>Your Email: <input name="email" type="text" id="email" /> </p> <p>Subject:<br/> <select name="subject" size="1" id="subject"> <option selected="selected">Select</option> <option value="Complaint">Complaint</option> <option value="Support">Support</option> <option value="Problems">Problems</option> </select> </p> <p>Message:<br/> <textarea name="content" rows="5" id="content"></textarea> </p> <p> <input type="submit" name="Submit" value="Submit" /> <input type="reset" name="Submit3" value="Reset" /> </p> </form></div> </td> </tr> </table> <br /><div align="center"><?php echo $copyright; ?></div><br /> </body> </html> mail.php: <?php $email = $_POST['email']; $subject = $_POST['subject']; $content = $_POST['content'] if($email == ""){ echo "Please, go back and fill out your email<br>\n"; } else if($subject == ""){ echo "Please, go back and fill out the subject<br>\n"; } else if($content == ""){ echo "Please, go back and fill out the content<br>\n"; } else{ echo "Thank you for emailing us! A receipt of your submission will be e-mailed to you almost immediately."; $mailContent= $content $toAddress="myemail"; $subject=$subject; $recipientSubject="Thank You"; $receiptMessage = "Thank you for your email us, we will contact you back as soon as possible"; mail($email, $subject, $content,"From:$toAddress"); mail($toAddress,$recipientSubject,$mailContent,"From:$email"); } } ?> </body> </html> Link to comment https://forums.phpfreaks.com/topic/58220-solved-mail-help/ Share on other sites More sharing options...
corillo181 Posted July 3, 2007 Share Posted July 3, 2007 you need to put semicolons to line 6, 18 and remove the las bracket on line 27 Link to comment https://forums.phpfreaks.com/topic/58220-solved-mail-help/#findComment-288671 Share on other sites More sharing options...
chris_rulez001 Posted July 3, 2007 Author Share Posted July 3, 2007 where abouts on line 16, 18 do i put the semicolon? Link to comment https://forums.phpfreaks.com/topic/58220-solved-mail-help/#findComment-288674 Share on other sites More sharing options...
corillo181 Posted July 3, 2007 Share Posted July 3, 2007 sorry..i meant $content = $_POST['content'] after this $mailContent= $content this mail($toAddress,$recipientSubject,$mailContent,"From:$email"); } } remove one of the brackets. Link to comment https://forums.phpfreaks.com/topic/58220-solved-mail-help/#findComment-288677 Share on other sites More sharing options...
chris_rulez001 Posted July 3, 2007 Author Share Posted July 3, 2007 thanks, but im getting another error: Parse error: syntax error, unexpected T_VARIABLE in /home/www/hostsareus.awardspace.co.uk/mail.php on line 18 Link to comment https://forums.phpfreaks.com/topic/58220-solved-mail-help/#findComment-288679 Share on other sites More sharing options...
corillo181 Posted July 3, 2007 Share Posted July 3, 2007 <?php $email = $_POST['email']; $subject = $_POST['subject']; $content = $_POST['content']; if($email == ""){ echo "Please, go back and fill out your email<br>\n"; } else if($subject == ""){ echo "Please, go back and fill out the subject<br>\n"; } else if($content == ""){ echo "Please, go back and fill out the content<br>\n"; } else{ echo "Thank you for emailing us! A receipt of your submission will be e-mailed to you almost immediately."; $mailContent= $content; $toAddress="myemail"; $subject=$subject; $recipientSubject="Thank You"; $receiptMessage = "Thank you for your email us, we will contact you back as soon as possible"; mail($email, $subject, $content,"From:$toAddress"); mail($toAddress,$recipientSubject,$mailContent,"From:$email"); } ?> Link to comment https://forums.phpfreaks.com/topic/58220-solved-mail-help/#findComment-288681 Share on other sites More sharing options...
chris_rulez001 Posted July 3, 2007 Author Share Posted July 3, 2007 thanks, it works now, but its not sending mail out, have i done everything right? Link to comment https://forums.phpfreaks.com/topic/58220-solved-mail-help/#findComment-288683 Share on other sites More sharing options...
corillo181 Posted July 3, 2007 Share Posted July 3, 2007 be sure to end all your variables with a semicolons since you have a couple of variable with no semicolons also when you creating statement make sure you don't add any extra bracket. why you have 2 mail function? Link to comment https://forums.phpfreaks.com/topic/58220-solved-mail-help/#findComment-288684 Share on other sites More sharing options...
chris_rulez001 Posted July 3, 2007 Author Share Posted July 3, 2007 all my variables are edited and ok, but its still not sending the mail out, whats going on? Link to comment https://forums.phpfreaks.com/topic/58220-solved-mail-help/#findComment-288688 Share on other sites More sharing options...
corillo181 Posted July 3, 2007 Share Posted July 3, 2007 probably the use of 2 mail functions you only need one. $mail($email,$subject,$mess,$header); Link to comment https://forums.phpfreaks.com/topic/58220-solved-mail-help/#findComment-288689 Share on other sites More sharing options...
chris_rulez001 Posted July 3, 2007 Author Share Posted July 3, 2007 ok it works now Link to comment https://forums.phpfreaks.com/topic/58220-solved-mail-help/#findComment-288693 Share on other sites More sharing options...
corillo181 Posted July 3, 2007 Share Posted July 3, 2007 mark the topic as solve if you don't have any farther questions. Link to comment https://forums.phpfreaks.com/topic/58220-solved-mail-help/#findComment-288695 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.