jesushax Posted April 23, 2008 Share Posted April 23, 2008 Hi here is my code for my contact form could anyone tell me if there is a problem here cos the emails arent sending :S Cheers <?php include($_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'); ?> <div id="subs"> <div id="subs-text">Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nullam mollis scelerisque mi.</div> <div id="subs-image"><img src="/images/layout/front/1.png" alt="Home Image" /></div> </div> <div id="backlinks"><?php include($_SERVER['DOCUMENT_ROOT'] . '/includes/backlinks.php'); ?></div> <div id="content"> <div id="content-left"> <h3>Contact Us</h3> <?php switch(@$_GET["action"]) { case "send": $name = $_POST["txtName"]; $email = $_POST["txtEmail"]; $tel = $_POST["txtTel"]; $details = $_POST["txtDetails"]; $to = $contactemail; $subject = "Contact Form"; $message = " <html> <head> <title>HTML email</title> </head> <body> <table> <tr> <td>Name:</td> <td>$name</td> </tr> <tr> <td>Email:</td> <td>$email</td> </tr> <tr> <td>Tel:</td> <td>$tel</td> </tr> <tr> <td style=\"vertical-align:top\">Details:</td> <td>$details</td> </tr> </table> </body> </html> ";// Always set content-type when sending HTML email $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";// More headers $headers .= 'From: [email protected]' . "\r\n"; mail($to,$subject,$message,$headers); echo '<p>your message</p>'; echo '<p>'; echo $message; echo '</p>'; echo '<p>Has been sent and one of your friendly team will get back to you as soon as possible.</p>'; break; default: ?> <form method="post" id="contact" action="?action=send"> <table> <tr> <td>Name:</td> <td><input name="txtName" type="text" id="txtName" size="50" /></td> </tr> <tr> <td>Email:</td> <td><input name="txtEmail" type="text" id="txtEmail" size="50" /></td> </tr> <tr> <td>Tel:</td> <td><input name="txtTel" type="text" id="txtTel" size="20" /></td> </tr> <tr> <td style="vertical-align:top">Details:</td> <td><textarea name="txtDetails" id="txtDetails" cols="35" rows="7"></textarea></td> </tr> <tr> <td> </td> <td><input type="submit" name="Submit" id="Submit" value="Submit" /></td> </tr> </table> </form> <?php break; } ?> </div> <div id="content-right"> </div> <?php include($_SERVER['DOCUMENT_ROOT'] . '/includes/footer.php'); ?> Quote Link to comment https://forums.phpfreaks.com/topic/102471-contact-form-error/ Share on other sites More sharing options...
jesushax Posted April 23, 2008 Author Share Posted April 23, 2008 can no one see a error? is there one anyway or is it something else? Quote Link to comment https://forums.phpfreaks.com/topic/102471-contact-form-error/#findComment-524760 Share on other sites More sharing options...
rajivgonsalves Posted April 23, 2008 Share Posted April 23, 2008 is your mail server working ? does the mail function give any errors. is your error reporting on? Quote Link to comment https://forums.phpfreaks.com/topic/102471-contact-form-error/#findComment-524762 Share on other sites More sharing options...
jesushax Posted April 23, 2008 Author Share Posted April 23, 2008 yes error reporting is on i get no error messages from it and i have echoed every variable to make sure they all work and nothing :S but the code is fine yes? Quote Link to comment https://forums.phpfreaks.com/topic/102471-contact-form-error/#findComment-524765 Share on other sites More sharing options...
rajivgonsalves Posted April 23, 2008 Share Posted April 23, 2008 The code looks fine however I did not test it Quote Link to comment https://forums.phpfreaks.com/topic/102471-contact-form-error/#findComment-524788 Share on other sites More sharing options...
conker87 Posted April 23, 2008 Share Posted April 23, 2008 Where are you setting $contactemail? Quote Link to comment https://forums.phpfreaks.com/topic/102471-contact-form-error/#findComment-524799 Share on other sites More sharing options...
jesushax Posted April 23, 2008 Author Share Posted April 23, 2008 $contactemail is set in the include emails.php Quote Link to comment https://forums.phpfreaks.com/topic/102471-contact-form-error/#findComment-524803 Share on other sites More sharing options...
conker87 Posted April 23, 2008 Share Posted April 23, 2008 $contactemail is set in the include emails.php Which doesn't seem to be included on the page... Unless it's part of the header? Quote Link to comment https://forums.phpfreaks.com/topic/102471-contact-form-error/#findComment-524807 Share on other sites More sharing options...
jesushax Posted April 23, 2008 Author Share Posted April 23, 2008 yes its in the header ive already posted all the variables they all echo a response so is it something server side? Cheers Quote Link to comment https://forums.phpfreaks.com/topic/102471-contact-form-error/#findComment-524830 Share on other sites More sharing options...
conker87 Posted April 23, 2008 Share Posted April 23, 2008 Could be something silly that your server is windows and you're using the wrong new line breaks? Quote Link to comment https://forums.phpfreaks.com/topic/102471-contact-form-error/#findComment-524860 Share on other sites More sharing options...
jesushax Posted April 23, 2008 Author Share Posted April 23, 2008 its on a linux server :S Quote Link to comment https://forums.phpfreaks.com/topic/102471-contact-form-error/#findComment-524875 Share on other sites More sharing options...
DarkWater Posted April 23, 2008 Share Posted April 23, 2008 Is it your own server, or is it a hosted server? You might have sendmail configured incorrectly. If you could SSH in or you have the box accessible, I could tell you how to find out, lol. Quote Link to comment https://forums.phpfreaks.com/topic/102471-contact-form-error/#findComment-524886 Share on other sites More sharing options...
jesushax Posted April 23, 2008 Author Share Posted April 23, 2008 when i send it to a address inside my doman it doesnt work i sent it to a hotmail account it works i dont fully understand ssh but know i have it set up on my account its on a hosted server what do i do with the ssh stuff? Quote Link to comment https://forums.phpfreaks.com/topic/102471-contact-form-error/#findComment-524939 Share on other sites More sharing options...
jesushax Posted April 23, 2008 Author Share Posted April 23, 2008 right i have this putty ssh software and am currently logged in but have no idea what to do here Quote Link to comment https://forums.phpfreaks.com/topic/102471-contact-form-error/#findComment-524949 Share on other sites More sharing options...
jesushax Posted April 24, 2008 Author Share Posted April 24, 2008 anyone know how to configure ssh so my contact form will send to my domain? cheers Quote Link to comment https://forums.phpfreaks.com/topic/102471-contact-form-error/#findComment-525834 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.