jimmyp3016 Posted March 21, 2008 Share Posted March 21, 2008 Hey Guys, My script runs perfect and inserts my form data into the database but it does not email the user. Can you look at the top part of my script and tell me why? Is it because its not grabbing the persons address? I think there is a problem with $to_address = $_GET['email']; email is the value of that field on this same page. 1. 2. 3. <?php 4. include 'clientmessage.php'; 5. function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 6. { 7. $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue; 8. 9. switch ($theType) { 10. case "text": 11. $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; 12. break; 13. case "long": 14. case "int": 15. $theValue = ($theValue != "") ? intval($theValue) : "NULL"; 16. break; 17. case "double": 18. $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL"; 19. break; 20. case "date": 21. $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; 22. break; 23. case "defined": 24. $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; 25. break; 26. } 27. return $theValue; 28. } 29. 30. $editFormAction = $_SERVER['PHP_SELF']; 31. if (isset($_SERVER['QUERY_STRING'])) { 32. $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); 33. } 34. 35. if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) { 36. $insertSQL = sprintf("INSERT INTO Customers (PlayLevel, Source, SourceDes, WithFriend, School, Sponsor, Asst, HCoach, CoachName, CoachDOB, CoachSSN, ShirtSize, CoachAddr, CoachPh, CoachEmail, Bcheck, Agreement, ModelRel, Name, ChildName, ChildShirt, addr1, addr2, City, `State`, Zip, Phone1, Phone2, email1, email2, Age, Birthday, Location) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)", 37. GetSQLValueString($_POST['PlayLevel'], "text"), 38. GetSQLValueString($_POST['Source'], "text"), 39. GetSQLValueString($_POST['SourceDes'], "text"), 40. GetSQLValueString($_POST['WithFriend'], "text"), 41. GetSQLValueString($_POST['School'], "text"), 42. GetSQLValueString(isset($_POST['Sponsor']) ? "true" : "", "defined","'Y'","'N'"), 43. GetSQLValueString(isset($_POST['Asst']) ? "true" : "", "defined","'Y'","'N'"), 44. GetSQLValueString(isset($_POST['HCoach']) ? "true" : "", "defined","'Y'","'N'"), 45. GetSQLValueString($_POST['CoachName'], "text"), 46. GetSQLValueString($_POST['CoachDOB'], "date"), 47. GetSQLValueString($_POST['CoachSSN'], "text"), 48. GetSQLValueString($_POST['ShirtSize'], "text"), 49. GetSQLValueString($_POST['CoachAddr'], "text"), 50. GetSQLValueString($_POST['CoachPh'], "text"), 51. GetSQLValueString($_POST['CoachEmail'], "text"), 52. GetSQLValueString(isset($_POST['Bcheck']) ? "true" : "", "defined","'Y'","'N'"), 53. GetSQLValueString(isset($_POST['Agreement']) ? "true" : "", "defined","'Y'","'N'"), 54. GetSQLValueString(isset($_POST['ModelRel']) ? "true" : "", "defined","'Y'","'N'"), 55. GetSQLValueString($_POST['Name'], "text"), 56. GetSQLValueString($_POST['ChildName'], "text"), 57. GetSQLValueString($_POST['ChildShirt'], "text"), 58. GetSQLValueString($_POST['addr1'], "text"), 59. GetSQLValueString($_POST['addr2'], "text"), 60. GetSQLValueString($_POST['City'], "text"), 61. GetSQLValueString($_POST['State'], "text"), 62. GetSQLValueString($_POST['Zip'], "text"), 63. GetSQLValueString($_POST['Phone1'], "text"), 64. GetSQLValueString($_POST['Phone2'], "text"), 65. GetSQLValueString($_POST['email1'], "text"), 66. GetSQLValueString($_POST['email2'], "text"), 67. GetSQLValueString($_POST['Age'], "text"), 68. GetSQLValueString($_POST['Birthday'], "text"), 69. GetSQLValueString($_POST['Location'], "text")); 70. 71. mysql_select_db($database_custs, $custs); 72. $Result1 = mysql_query($insertSQL, $custs) or die(mysql_error()); 73. 74. $to_address = $_GET['email']; 75. mail ("$to_address", "$subject", "$mail_body", "From: [email protected]"); 76. 77. $insertGoTo = "/SignupComplete.htm"; 78. if (isset($_SERVER['QUERY_STRING'])) { 79. $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?"; 80. $insertGoTo .= $_SERVER['QUERY_STRING']; 81. } 82. header(sprintf("Location: %s", $insertGoTo)); 83. } 84. ?> Link to comment https://forums.phpfreaks.com/topic/97285-email-not-sending-quick-problem/ Share on other sites More sharing options...
Caesar Posted March 21, 2008 Share Posted March 21, 2008 The email address gets passed through the url? Probably not wise. Anyway, have you printed out the $_GET['email'] variable before the mail function just to see if it's there? Link to comment https://forums.phpfreaks.com/topic/97285-email-not-sending-quick-problem/#findComment-497840 Share on other sites More sharing options...
jimmyp3016 Posted March 21, 2008 Author Share Posted March 21, 2008 I guess its not passing through the url. What is an easy way to get the users address to input it in the $to_address field after it posts in the database? The users email is email1 Any help would be great thanks! Link to comment https://forums.phpfreaks.com/topic/97285-email-not-sending-quick-problem/#findComment-497846 Share on other sites More sharing options...
jimmyp3016 Posted March 21, 2008 Author Share Posted March 21, 2008 Can someone help me real quick? Please! Link to comment https://forums.phpfreaks.com/topic/97285-email-not-sending-quick-problem/#findComment-497935 Share on other sites More sharing options...
Caesar Posted March 21, 2008 Share Posted March 21, 2008 Where is the email being defined? Database? Form? Link to comment https://forums.phpfreaks.com/topic/97285-email-not-sending-quick-problem/#findComment-497947 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.