943,106 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 755
  • PHP RSS
Feb 7th, 2010
0

PHP contact form stopped working?

Expand Post »
PHP Syntax (Toggle Plain Text)
  1. <?php
  2. $a = '10';
  3.  
  4.  
  5. if ($_POST["email"]<>'' && $_POST["val"] == "$a" ) {
  6. $ToEmail = 'myemail';
  7. $EmailSubject = 'Site contact form ';
  8. $mailheader = "From: ".$_POST["email"]."\r\n";
  9. $mailheader .= "Reply-To: ".$_POST["email"]."\r\n";
  10. $mailheader .= "Content-type: text/html; charset=iso-8859-1\r\n";
  11. $MESSAGE_BODY = "Name: ".$_POST["name"]."<br>";
  12. $MESSAGE_BODY .= "Email: ".$_POST["email"]."<br>";
  13. $MESSAGE_BODY .= "Comment: ".nl2br($_POST["comment"])."<br>";
  14.  
  15. mail($ToEmail, $EmailSubject, $MESSAGE_BODY, $mailheader) or die ("Failure");
  16. ?>
  17.  
  18. <h1>Your message was sent</h1>
  19.  
  20. <?php
  21. }
  22. else
  23. {
  24. ?>
  25. <form action="contact.php" method="post">
  26. <table width="400" border="0" cellspacing="2" cellpadding="0">
  27. <tr>
  28. <td width="29%" class="bodytext">Your name:</td>
  29. <td width="71%"><input name="name" type="text" id="name" size="32"></td>
  30. </tr>
  31. <tr>
  32. <td class="bodytext">Email address:</td>
  33. <td><input name="email" type="text" id="email" size="32"></td>
  34. </tr>
  35. <tr>
  36. <td class="bodytext">Comment:</td>
  37. <td><textarea name="comment" cols="45" rows="6" id="comment" class="bodytext"></textarea></td>
  38. </tr>
  39. <tr>
  40. <td class="bodytext">Validation:</td>
  41. <td>3 + 7 = <input type="text" name="val" />
  42. </td>
  43. </tr>
  44. <tr>
  45. <td class="bodytext">&nbsp;</td>
  46. <td align="left" valign="top"><input type="submit" name="Submit" value="Send"></td>
  47. </tr>
  48.  
  49. </table>
  50.  
  51.  
  52. </form>
  53. <?php
  54.  
  55. };
  56. ?>

this code worked for bout 2 weeks and now does not send the email? it says the message has been sent but i recieve nothing, i have tried this with a hotmail acount and my email address for my site and nothing is working? any help
Similar Threads
Reputation Points: 10
Solved Threads: 0
Junior Poster
nats01282 is offline Offline
111 posts
since Jul 2009
Feb 8th, 2010
0
Re: PHP contact form stopped working?
Hi, I have the same error in my PHP application, I’ve tried many options, but finally I’ve decided to change the hosting company. By the way you can try to add this code into you page to see if they are errors displaying or not


PHP Syntax (Toggle Plain Text)
  1. ini_set('display_errors', 1);


Also try this

PHP Syntax (Toggle Plain Text)
  1. If (!mail($ToEmail, $EmailSubject, $MESSAGE_BODY, $mailheader)){
  2.  
  3. Echo”error sending message”;
  4.  
  5. } else {
  6.  
  7. echo”message was sent”;
  8.  
  9. }

this all that we can try, but in my other hosting company all works properly so I will change all there, I think this is the PHP server or version problem or something like this, I don’t think that it is the our code problem.

Regards
Last edited by Arsench; Feb 8th, 2010 at 8:03 am.
Reputation Points: 10
Solved Threads: 2
Light Poster
Arsench is offline Offline
36 posts
since Oct 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Updating multiple rows in mysql...how to add a checkbox!
Next Thread in PHP Forum Timeline: Regular expression





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC