Jump to content

Recommended Posts

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>	

Link to comment
https://forums.phpfreaks.com/topic/238999-processing-script-issues/
Share on other sites

*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);

?>


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  :shrug:

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.