psquillace Posted May 18, 2007 Share Posted May 18, 2007 Hello All: I am making a tell a friend script work at http://www.kardwelldev.com/customwedding/tellafriend.php. However, even with the show errors turned on, Nothing happens on submit. I just get the page page but blank. ??? How do I know what is wrong if it does not show errors? Here is a piece of that code <?php ini_set ('display_errors', 'On'); error_reporting (E_ALL); if (dirname($_SERVER['PHP_SELF']) == '/') { $rel_path = ""; } else { $rel_path = "../"; } $valid_hosts = array ('http://www.kardwelldev.com/customwedding/'); $errors = ''; $user_data = array(); $user_data['host'] = gethostbyaddr($_SERVER['REMOTE_ADDR']); $user_data['ip'] = $_SERVER['REMOTE_ADDR']; $user_data['agent']= $_SERVER['HTTP_USER_AGENT']; if (isset($_SERVER['HTTP_REFERER'])) { $user_data['ref'] = $_SERVER['HTTP_REFERER']; } else { $user_data['ref'] = ''; } $user_data['time'] = date("D M j G:i:s Y"); include ($rel_path . 'customwedding/includes/email_validate.inc'); // Include custom email validation script if (isset($_POST['submit']) && ($_POST['submit'] == 'Submit')) { // Handle the form. $message = NULL; // Create a new empty variable. // Check for a First Name. if (empty($_POST['firstname']) || !valid_string($_POST['firstname'])) { $firstname = FALSE; $message .= 'Please provide your First Name!<br>'; } else { $firstname = $_POST['firstname']; } // Check for a Last Name. if (empty($_POST['lastname']) || !valid_string($_POST['lastname'])) { $lastname = FALSE; $message .= 'Please provide your Last Name!<br>'; } else { $lastname = $_POST['lastname']; } // Check for a Last Name. if (empty($_POST['youremail']) || !valid_string($_POST['youremail'])) { $youremail = FALSE; $message .= 'Please provide your E-Mail Address!<br>'; } else { $youremail = $_POST['youremail']; } // Check for at least one email address. if (empty($_POST['friend1']) || !valid_string($_POST['friend1'])) { $friend1 = FALSE; $message .= 'Please provide at least one E-Mail Address!<br>'; } else { $friend1 = $_POST['friend1']; } if ( $firstname && $lastname && $youremail && $friend1 && check_referer() ) { // If eveything is OK // Send an email, if desired. $recipient_email = 'paul@kardwell.com'; // to add more to this list just add a comma and then the next email address, e.g. 'email1@email.com, email2@email.com, email3@email.com' $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/plain; utf-8' . "\r\n"; $headers .= 'From: Referral Form <paul@kardwell.com>' . "\r\n"; $headers .= 'Return-Path: paul@kardwell.com' . "\r\n"; $body = "CustomWedding Referral Form Submission\r\n"; $body .= 'Submit Date Time: ' . $user_data['time'] . "\r\n"; $body = 'The following feedback was submitted from ' . $_SERVER['HTTP_HOST'] . "\r\n\r\n"; $body .= 'First Name: ' . stripslashes(htmlspecialchars($firstname)) . "\r\n"; $body .= 'Last Name: ' . stripslashes(htmlspecialchars($lastname)) . "<br>\r\n"; $body .= 'Thier Email: ' . stripslashes(htmlspecialchars($youremail)) . "<br>\r\n"; $body .= 'Referral 1: ' . stripslashes(htmlspecialchars($friend1)) . "<br>\r\n"; $body .= 'Referral 2: ' . stripslashes(htmlspecialchars($friend2)) . "<br>\r\n"; $body .= 'Referral 3: ' . stripslashes(htmlspecialchars($friend3)) . "<br>\r\n"; $body .= 'Referral 4: ' . stripslashes(htmlspecialchars($friend4)) . "<br>\r\n"; $body .= 'Referral 5: ' . stripslashes(htmlspecialchars($friend5)) . "<br>\r\n"; $body .= 'Optional Message Sent: ' . stripslashes(htmlspecialchars($optional)) . "<br>\r\n"; $body .= 'Host: ' . $user_data['host'] . "\r\n"; $body .= 'IP: ' . $user_data['ip'] . "\r\n"; $body .= 'Remote Agent: ' . $user_data['agent'] . "\r\n"; $body .= 'Referrer: ' . $user_data['ref'] . "\r\n"; $body .= "Sincerely,\r\nKardwell International"; mail ($recipient_email, 'Referrals from Customwedding.com', $body, $headers); $message = 'Your message was successfully delivered!<br>Thank you for referring others to Customwedding.com.'; } else { // If it did not run OK. $message .= 'Please try again!'; } } // End of the main Submit conditional. ?> Quote Link to comment https://forums.phpfreaks.com/topic/52039-form-submit-and-i-get-nothing-in-returnplease-help/ Share on other sites More sharing options...
kenrbnsn Posted May 18, 2007 Share Posted May 18, 2007 Put <?php echo '<pre>' . print_r($_POST,true) . '</pre>'; ?> at the start of the script to see what is being returned to the script from the form. It may give you a hint as to what is wrong. Ken Quote Link to comment https://forums.phpfreaks.com/topic/52039-form-submit-and-i-get-nothing-in-returnplease-help/#findComment-256534 Share on other sites More sharing options...
psquillace Posted May 18, 2007 Author Share Posted May 18, 2007 Thanks Ken, But isnt that what ini_set ('display_errors', 'On'); error_reporting (E_ALL); is supposed to do??? thanks for helping a php noob out on this, Paul Quote Link to comment https://forums.phpfreaks.com/topic/52039-form-submit-and-i-get-nothing-in-returnplease-help/#findComment-256536 Share on other sites More sharing options...
Barand Posted May 18, 2007 Share Posted May 18, 2007 Perhaps there aren't any errors, and as the script doesn't actually output anything the screen will be blank. Quote Link to comment https://forums.phpfreaks.com/topic/52039-form-submit-and-i-get-nothing-in-returnplease-help/#findComment-256537 Share on other sites More sharing options...
psquillace Posted May 18, 2007 Author Share Posted May 18, 2007 ok, so I did what you said and got this at the top Array ( [firstname] => Paul [lastname] => Squillace [yourmail] => paul@kardwell.com [friend1] => paul@kardwell.com [friend2] => [friend3] => [friend4] => [friend5] => [optional] => Testing [customerInfo] => on ) I guess it is all going somewhere but now what??? Quote Link to comment https://forums.phpfreaks.com/topic/52039-form-submit-and-i-get-nothing-in-returnplease-help/#findComment-256539 Share on other sites More sharing options...
kenrbnsn Posted May 18, 2007 Share Posted May 18, 2007 No, <?php ini_set ('display_errors', 'On'); error_reporting (E_ALL); ?> Just makes sure all errors that may be occurring are displayed. The code I posted will display what is being returned from the form to your script. Ken Quote Link to comment https://forums.phpfreaks.com/topic/52039-form-submit-and-i-get-nothing-in-returnplease-help/#findComment-256541 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.