Jump to content

Form Submit and I get nothing in return......please help...


psquillace

Recommended Posts

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 = '[email protected]'; // to add  more to this list just add a comma and then the next email address, e.g. '[email protected], [email protected], [email protected]'
	$headers  = 'MIME-Version: 1.0' . "\r\n";
	$headers .= 'Content-type: text/plain; utf-8' . "\r\n";
	$headers .= 'From: Referral Form <[email protected]>' . "\r\n";
	$headers .= 'Return-Path: [email protected]' . "\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.

?>

ok, so I did what you said and got this at the top

 

Array
(
    [firstname] => Paul
    [lastname] => Squillace
    [yourmail] => [email protected]
    [friend1] => [email protected]
    [friend2] => 
    [friend3] => 
    [friend4] => 
    [friend5] => 
    [optional] => Testing
    [customerInfo] => on
)

 

I guess it is all going somewhere but now what???

 

 

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.