kdolan89 Posted June 10, 2011 Share Posted June 10, 2011 Hey There Guys, I am looking for a little help with this form processing script, any help would be very much appreciated. When The form is submitted lite_process.php is called but does not process the form, it just displays a white screen \\\\lite_settings.php <?php $email_to = "kyle-dolan@smh.com"; // your email address $email_subject = "New Trial Member"; // email subject line $thankyou = "http://www.sarasotahealthplex.com"; // thank you page ?> \\\\lite_process.php <?php if(isset($_POST['Email_Address'])) { include 'lite_settings.php'; function died($error) { echo "Sorry, but there were error(s) found with the form you submitted. "; echo "These errors appear below.<br /><br />"; echo $error."<br /><br />"; echo "Please go back and fix these errors.<br /><br />"; die(); } if(!isset($_POST['element_1_1']) || !isset($_POST['element_1_2']) || !isset($_POST['element_2_1']) || !isset($_POST['element_2_3']) || !isset($_POST['element_2_4']) || !isset($_POST['element_2_5']) || !isset($_POST['element_3']) || !isset($_POST['element_4_1']) || !isset($_POST['element_4_2']) || !isset($_POST['element_4_3']) || !isset($_POST['element_5_1']) || !isset($_POST['element_5_2'])) { died('We are sorry, but there appears to be a problem with the form you submitted.'); } $first_name = $_POST['element_1_1']; // required $last_name = $_POST['element_1_2']; // required $street = $_POST['element_2_1']; // required $city = $_POST['element_2_3']; // required $state = $_POST['element_2_4']; // required $zip = $_POST['element_2_5']; // required $email_from = $_POST['element_3']; // required $telephone1 = $_POST['element_4_1']; // not required $telephone2 = $_POST['element_4_2']; // required $telephone3 = $_POST['element_4_3']; // required $reffirst_name = $_POST['element_5_1']; // required $reflast_name = $_POST['element_5_2']; // required $error_message = ""; $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/'; if(preg_match($email_exp,$email_from)==0) { $error_message .= 'The Email Address you entered does not appear to be valid.<br />'; } if(strlen($first_name) < 2) { $error_message .= 'Your first Name does not appear to be valid.<br />'; } if(strlen($last_name) < 2) { $error_message .= 'Your last Name does not appear to be valid.<br />'; } if(strlen($error_message) > 0) { died($error_message); } $email_message = "New Trial Member info below.\r\n"; function clean_string($string) { $bad = array("content-type","bcc:","to:","cc:","href"); return str_replace($bad,"",$string); } $email_message .= "Full Name: ".clean_string($full_name)."\r\n"; $email_message .= "Last Name: ".clean_string($last name)."\r\n"; $email_message .= "Telephone: ".clean_string($street)."\r\n"; $email_message .= "Message: ".clean_string($city)."\r\n"; $email_message .= "Message: ".clean_string($state)."\r\n"; $email_message .= "Message: ".clean_string($zip)."\r\n"; $email_message .= "Message: ".clean_string($email_from)."\r\n"; $email_message .= "Message: ".clean_string($telephone1)."\r\n"; $email_message .= "Message: ".clean_string($telephone2)."\r\n"; $email_message .= "Message: ".clean_string($telephone3)."\r\n"; $email_message .= "Message: ".clean_string($reffirst_name)."\r\n"; $email_message .= "Message: ".clean_string($reflast_name)."\r\n"; $headers = 'From: '.$email_from."\r\n". 'Reply-To: '.$email_from."\r\n" . 'X-Mailer: PHP/' . phpversion(); @mail($email_to, $email_subject, $email_message, $headers); header("Location: $thankyou"); ?> <script>location.replace('<?php echo $thankyou;?>')</script> <?php } die(); ?> \\\\ Form <html> <form id="form_187243" class="appnitro" method="post" action="lite_process.php" onSubmit="return validate.check(this)"> <div class="form_description"> <h2 align="center">Fit 4 U Free Trial registration</h2> <p> <center> After filling out this form your one week pass will be emailed to you. </center></p> </div> <ul > <li id="li_1" > <label class="description" for="element_1">Name </label> <span> <input id="element_1_1" name= "element_1_1" class="element text" maxlength="255" size="8" value=""/> <label>First</label> </span> <span> <input id="element_1_2" name= "element_1_2" class="element text" maxlength="255" size="14" value=""/> <label>Last</label> </span> </li> <li id="li_2" > <label class="description" for="element_2">Address </label> <div> <input id="element_2_1" name="element_2_1" class="element text large" value="" type="text"> <label for="element_2_1">Street Address</label> </div> <div class="left"> <input id="element_2_3" name="element_2_3" class="element text medium" value="" type="text"> <label for="element_2_3">City</label> </div> <div class="right"> <input id="element_2_4" name="element_2_4" class="element text medium" value="" type="text"> <label for="element_2_4">State / Province / Region</label> </div> <div class="left"> <input id="element_2_5" name="element_2_5" class="element text medium" maxlength="15" value="" type="text"> <label for="element_2_5">Postal / Zip Code</label> </div> </li> <li id="li_3" > <label class="description" for="element_3">Email </label> <div> <input id="element_3" name="element_3" class="element text medium" type="text" maxlength="255" value=""/> </div> </li> <li id="li_4" > <label class="description" for="element_4">Phone </label> <span> <input id="element_4_1" name="element_4_1" class="element text" size="3" maxlength="3" value="" type="text"> - <label for="element_4_1">(###)</label> </span> <span> <input id="element_4_2" name="element_4_2" class="element text" size="3" maxlength="3" value="" type="text"> - <label for="element_4_2">###</label> </span> <span> <input id="element_4_3" name="element_4_3" class="element text" size="4" maxlength="4" value="" type="text"> <label for="element_4_3">####</label> </span> </li> <li id="li_5" > <label class="description" for="element_5">Referred by </label> <span> <input id="element_5_1" name= "element_5_1" class="element text" maxlength="255" size="8" value=""/> <label>First</label> </span> <span> <input id="element_5_2" name= "element_5_2" class="element text" maxlength="255" size="14" value=""/> <label>Last</label> </span> </li> <li class="buttons"> <input type="hidden" name="form_id" value="187243" /> <input id="saveForm" class="button_text" type="submit" name="submit" value="Submit" /> </li> </ul> </form> </html> Quote Link to comment https://forums.phpfreaks.com/topic/238999-processing-script-issues/ Share on other sites More sharing options...
Ollifi Posted June 10, 2011 Share Posted June 10, 2011 Does it give any error in server error log? Maybe you can try add following to lite_process.php file? ini_set("display_errors", 1); error_reporting(E_ALL); Quote Link to comment https://forums.phpfreaks.com/topic/238999-processing-script-issues/#findComment-1228028 Share on other sites More sharing options...
wildteen88 Posted June 10, 2011 Share Posted June 10, 2011 You either have errors in your code or it is because of die(); here <?php } die(); ?> Maybe you should have those lines in reverse order <?php die(); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/238999-processing-script-issues/#findComment-1228029 Share on other sites More sharing options...
kdolan89 Posted June 10, 2011 Author Share Posted June 10, 2011 http://www.sarasotahealthplex.com/fit4u/fit4upage.html I added that to my script and it still shows nothing Quote Link to comment https://forums.phpfreaks.com/topic/238999-processing-script-issues/#findComment-1228030 Share on other sites More sharing options...
Ollifi Posted June 10, 2011 Share Posted June 10, 2011 Did you read my and wildteen88´s messages both ? Quote Link to comment https://forums.phpfreaks.com/topic/238999-processing-script-issues/#findComment-1228034 Share on other sites More sharing options...
kdolan89 Posted June 10, 2011 Author Share Posted June 10, 2011 yes Quote Link to comment https://forums.phpfreaks.com/topic/238999-processing-script-issues/#findComment-1228036 Share on other sites More sharing options...
kdolan89 Posted June 10, 2011 Author Share Posted June 10, 2011 I removed the <?php } die(); ?> and its still blank Quote Link to comment https://forums.phpfreaks.com/topic/238999-processing-script-issues/#findComment-1228038 Share on other sites More sharing options...
Ollifi Posted June 10, 2011 Share Posted June 10, 2011 Please look the path (with FTP software) for any error_log or something like it file. Quote Link to comment https://forums.phpfreaks.com/topic/238999-processing-script-issues/#findComment-1228039 Share on other sites More sharing options...
kdolan89 Posted June 10, 2011 Author Share Posted June 10, 2011 did you look at the page? Quote Link to comment https://forums.phpfreaks.com/topic/238999-processing-script-issues/#findComment-1228041 Share on other sites More sharing options...
Ollifi Posted June 10, 2011 Share Posted June 10, 2011 Yes, I looked http://www.sarasotahealthplex.com/fit4u/lite_process.php and it was blank. But did you found the error log file? Quote Link to comment https://forums.phpfreaks.com/topic/238999-processing-script-issues/#findComment-1228042 Share on other sites More sharing options...
kdolan89 Posted June 10, 2011 Author Share Posted June 10, 2011 My error_docs Folder doesn't have anything in it from today Quote Link to comment https://forums.phpfreaks.com/topic/238999-processing-script-issues/#findComment-1228043 Share on other sites More sharing options...
Ollifi Posted June 10, 2011 Share Posted June 10, 2011 Hmm, then I´m not sure what would cause it. Maybe some other can find something wrong in the code? Just wait for some other to respond. Quote Link to comment https://forums.phpfreaks.com/topic/238999-processing-script-issues/#findComment-1228044 Share on other sites More sharing options...
kdolan89 Posted June 10, 2011 Author Share Posted June 10, 2011 well I appreciate your help anyways, thanks for everything Quote Link to comment https://forums.phpfreaks.com/topic/238999-processing-script-issues/#findComment-1228048 Share on other sites More sharing options...
Drummin Posted June 10, 2011 Share Posted June 10, 2011 Looks like this line might be killing it because unexpected T_STRING. $email_message .= "Last Name: ".clean_string($last name)."\r\n"; Notice, $last name should be $last_name Quote Link to comment https://forums.phpfreaks.com/topic/238999-processing-script-issues/#findComment-1228057 Share on other sites More sharing options...
kdolan89 Posted June 13, 2011 Author Share Posted June 13, 2011 *Update Making some progress but the script is still not working, check out the updated script -- -- <?php if(isset($_POST['element_3'])) { function died($error) { echo "Sorry, but there were error(s) found with the form you submitted. "; echo "These errors appear below.<br /><br />"; echo $error."<br /><br />"; echo "Please go back and fix these errors.<br /><br />"; die(); } if(!isset($_POST['element_1_1']) || !isset($_POST['element_1_2']) || !isset($_POST['element_2_1']) || !isset($_POST['element_2_3']) || !isset($_POST['element_2_4']) || !isset($_POST['element_2_5']) || !isset($_POST['element_3']) || !isset($_POST['element_4_1']) || !isset($_POST['element_4_2']) || !isset($_POST['element_4_3']) || !isset($_POST['element_5_1']) || !isset($_POST['element_5_2'])) { died('We are sorry, but there appears to be a problem with the form you submitted.'); } $first_name = $_POST['element_1_1']; // required $last_name = $_POST['element_1_2']; // required $street = $_POST['element_2_1']; // required $city = $_POST['element_2_3']; // required $state = $_POST['element_2_4']; // required $zip = $_POST['element_2_5']; // required $email_from = $_POST['element_3']; // required $telephone1 = $_POST['element_4_1']; // not required $telephone2 = $_POST['element_4_2']; // required $telephone3 = $_POST['element_4_3']; // required $reffirst_name = $_POST['element_5_1']; // required $reflast_name = $_POST['element_5_2']; // required $error_message = ""; $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/'; if(preg_match($email_exp,$email_from)==0) { $error_message .= 'The Email Address you entered does not appear to be valid.<br />'; } if(strlen($first_name) < 2) { $error_message .= 'Your first Name does not appear to be valid.<br />'; } if(strlen($last_name) < 2) { $error_message .= 'Your last Name does not appear to be valid.<br />'; } if(strlen($error_message) > 0) { died($error_message); } $email_message = "New Trial Member info below.\r\n"; function clean_string($string) { $bad = array("content-type","bcc:","to:","cc:","href"); return str_replace($bad,"",$string); } $email_message .= "Full Name: ".clean_string($full_name)."\r\n"; $email_message .= "Last Name: ".clean_string($last_name)."\r\n"; $email_message .= "Telephone: ".clean_string($street)."\r\n"; $email_message .= "City: ".clean_string($city)."\r\n"; $email_message .= "State: ".clean_string($state)."\r\n"; $email_message .= "Zip code: ".clean_string($zip)."\r\n"; $email_message .= "Email Address: ".clean_string($email_from)."\r\n"; $email_message .= "Area code: ".clean_string($telephone1)."\r\n"; $email_message .= "Phone: ".clean_string($telephone2)."\r\n"; $email_message .= "Number: ".clean_string($telephone3)."\r\n"; $email_message .= "Refered by first and: ".clean_string($reffirst_name)."\r\n"; $email_message .= "Last Name: ".clean_string($reflast_name)."\r\n"; $email_to = "kyle-dolan@smh.com"; // your email address $email_subject = "New Trial Member"; // email subject line $thankyou = "http://www.sarasotahealthplex.com"; // thank you page $headers = 'From: '.$email_from."\r\n". 'Reply-To: '.$email_from."\r\n" . 'X-Mailer: PHP/' . phpversion(); @mail($email_to, $email_subject, $email_message, $headers); header("Location: $thankyou"); ini_set("display_errors", 1); error_reporting(E_ALL); ?> Quote Link to comment https://forums.phpfreaks.com/topic/238999-processing-script-issues/#findComment-1228867 Share on other sites More sharing options...
kdolan89 Posted June 13, 2011 Author Share Posted June 13, 2011 Looks like this line might be killing it because unexpected T_STRING. $email_message .= "Last Name: ".clean_string($last name)."\r\n"; Notice, $last name should be $last_name Thank you I fixed that and a few other things I found but its still blank paging me Quote Link to comment https://forums.phpfreaks.com/topic/238999-processing-script-issues/#findComment-1228869 Share on other sites More sharing options...
wildteen88 Posted June 13, 2011 Share Posted June 13, 2011 These lines ini_set("display_errors", 1); error_reporting(E_ALL); Should be the first two lines in your code, not at the very bottom of the page. Quote Link to comment https://forums.phpfreaks.com/topic/238999-processing-script-issues/#findComment-1229186 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.