Jump to content

I'm having problems deleting cookies, and having consistent emails sent.


Recommended Posts

I'm having problems deleting cookies, and having consistent emails sent. It won't delete the cookies and it only sends every other email. So if I go fill it out submit it, I will receive an email and then if I do it again I won't but then if I go back it will send that email. So it goes 1,3,5,7 etc.

 

Here is what is happening-

STEP 1. - I have a form that gathers information.

STEP 2. - When the user hits submit from form1 it takes them to form2 with the info that they previously entered populated into the fields along with some additional information.

STEP 3. - They fill out the information then hit submit it then creates the cookies of the information they filled out and sends an email as long as the Name and Email address filed was entered. It then should delete the cookies.

 

Here is the code after the information has been entered in and creates the cookies and then sends the email.

 

<?php 
  		$Name = $_POST['Name'];
	$Area_Code = $_POST['Area_Code'];
	$phone_prefix = $_POST['phone_prefix'];
	$phone_code = $_POST['phone_code'];
	$Mobile_Area_Code = $_POST['Mobile_Area_Code'];
	$mobile_phone_prefix = $_POST['mobile_phone_prefix'];
	$mobile_phone_code = $_POST['mobile_phone_code'];
	$Best_Time = $_POST['Best_Time'];
	$Email = $_POST['Email'];

	$house_number = $_POST['house_number'];
	$Street_Name = $_POST['Street_Name'];
	$City = $_POST['City'];
	$State = $_POST['State'];
	$County = $_POST['County'];
	$Zip = $_POST['Zip'];
	$Property_Information = $_POST['Property_Information'];
	$Referral = $_POST['Referral'];
	$Referral_other = $_POST['Referral_other'];

		setcookie("Name", $Name, time()+60*60*24*30);
		setcookie("Area_Code", $Area_Code, time()+60*60*24*30);
		setcookie("phone_prefix", $phone_prefix, time()+60*60*24*30);
		setcookie("phone_code", $phone_code, time()+60*60*24*30);
		setcookie("Mobile_Area_Code", $Mobile_Area_Code, time()+60*60*24*30);
		setcookie("mobile_phone_prefix", $mobile_phone_prefix, time()+60*60*24*30);
		setcookie("mobile_phone_code", $mobile_phone_code, time()+60*60*24*30);
		setcookie("Best_Time", $Best_Time, time()+60*60*24*30);
		setcookie("Email", $Email, time()+60*60*24*30);
		setcookie("house_number", $house_number, time()+60*60*24*30);
		setcookie("Street_Name", $Street_Name, time()+60*60*24*30);
		setcookie("City", $City, time()+60*60*24*30);
		setcookie("State", $State, time()+60*60*24*30);
		setcookie("County", $County, time()+60*60*24*30);
		setcookie("County", $County, time()+60*60*24*30);
		setcookie("Zip", $Zip, time()+60*60*24*30);
		setcookie("Property_Information", $Property_Information, time()+60*60*24*30);
		setcookie("Referral", $Referral, time()+60*60*24*30);
		setcookie("Referral_other", $Referral_other, time()+60*60*24*30);

	$Owner_Select = $_POST['Owner_Select'];
	$Owner_Name = $_POST['Owner_Name'];
	$Quickly_Sell = $_POST['Quickly_Sell'];
	$Why_Sell = $_POST['Why_Sell'];
	$Type_Property = $_POST['Type_Property'];
	$Property_Condition = $_POST['Property_Condition'];
	$Property_Value = $_POST['Property_Value'];
	$Accept_Quick_Sale = $_POST['Accept_Quick_Sale'];
	$Square_Footage = $_POST['Square_Footage'];
	$Number_Bedrooms = $_POST['Number_Bedrooms'];
	$Number_Bathrooms = $_POST['Number_Bathrooms'];
	$Property_Age = $_POST['Property_Age'];
	$Property_Occupied = $_POST['Property_Occupied'];
	$Realtor = $_POST['Realtor'];
	$Mortgage_Balance = $_POST['Mortgage_Balance'];
	$Monthly_Payment = $_POST['Monthly_Payment'];
	$Current_Payments = $_POST['Current_Payments'];
	$Second_Mortgage_Balance = $_POST['Second_Mortgage_Balance'];

		setcookie("Owner_Select", $Owner_Select, time()+60*60*24*30);
		setcookie("Owner_Name", $Owner_Name, time()+60*60*24*30);
		setcookie("Quickly_Sell", $Quickly_Sell, time()+60*60*24*30);
		setcookie("Why_Sell", $Why_Sell, time()+60*60*24*30);
		setcookie("Type_Property", $Type_Property, time()+60*60*24*30);
		setcookie("Property_Condition", $Property_Condition, time()+60*60*24*30);
		setcookie("Property_Value", $Property_Value, time()+60*60*24*30);
		setcookie("Accept_Quick_Sale", $Accept_Quick_Sale, time()+60*60*24*30);
		setcookie("Square_Footage", $Square_Footage, time()+60*60*24*30);
		setcookie("Number_Bedrooms", $Number_Bedrooms, time()+60*60*24*30);
		setcookie("Number_Bathrooms", $Number_Bathrooms, time()+60*60*24*30);	
		setcookie("Property_Age", $Property_Age, time()+60*60*24*30);	
		setcookie("Property_Occupied", $Property_Occupied, time()+60*60*24*30);	
		setcookie("Realtor", $Realtor, time()+60*60*24*30);	
		setcookie("Mortgage_Balance", $Mortgage_Balance, time()+60*60*24*30);	
		setcookie("Monthly_Payment", $Monthly_Payment, time()+60*60*24*30);	
		setcookie("Current_Payments", $Current_Payments, time()+60*60*24*30);	
		setcookie("Second_Mortgage_Balance", $Second_Mortgage_Balance, time()+60*60*24*30);	

header("Location:CreateSendBoth.php");
?>

 

Here is the code for the send.

 

<?php 
// Verifies that it was sent properly if not displays an Error message.
if ($Name == "" || $Email == "" )
{
	echo "<script>window.open('Failure.html','_blank','toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no resizable=no, copyhistory=no, width=400, height=300');</script>";
			echo "<div align='center' class='left_navbox_form_text_title'>
		 <img src='../images/bussiness.jpg' alt='house_hand' id='main_img'/>
			<br />
		<strong>THERE HAS BEEN AN ERROR!</strong>
		<br /><br />
    		 We encountered an error while processing your request please contact us at 1-800-273-5546
    			<br />
		 If a new window did not open please 
		 	<br />
			<A href='javascript: window.open ('../index.php', '_blank','')' onblur='javascript: self.close ()' class='navlink'>Click here to go back to 		                18002SellHomes.com home page.</A></div>";

$to  = "WebMaster@18002SellHomes.com" . ", "; 
$subject = "ERROR Contact Form";
$headers  = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1" . "\r\n";
$headers .= "From: PostMaster@18002SellHomes.com" . "\r\n";
//$headers .= "Bcc: PostMaster@18002SellHomes.com" . "\r\n";	
$message = "There was an error while trying to send the SendBoth Form the Name and/or email fiedl(s) were empty even though it is a required field.";

$Sent = mail($to, $subject, $message, $headers);	
die();

} else {

//Asigns all the Product info from the Order.php page to a variable
// Send the email.
$Sent = mail($to, $subject, $message, $headers);
if($Sent)
{
	echo "<script>window.open('Success.php','_blank','toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no resizable=no, copyhistory=no, 								              width=400, height=300');</script>";
	echo "<script>window.open('http://www.18002sellhomes.com','_blank');</script>";		
	echo "<div align='center' class='left_navbox_form_text_title'>
		 <img src='../images/house_hand.jpg' alt='house_hand' id='main_img'/>
			<br />
    		 Your request was processed successfully an 1-800-2SellHomes Agent will be in contact with you shortly!
    			<br />
    		 If you have any questions please feel free to contact us at 1-800-2SellHomes (1-800-273-5546).
    			<br />
		 If a new window did not open please 
		 	<br />
			<A href='javascript: window.open ('../index.php', '_blank','')' onblur='javascript: self.close ()' class='navlink'>Click here to go back to                18002SellHomes.com home page.</A></div>";




			print_r($_COOKIE);

} else {
	echo "<script>window.open('Failure.html','_blank','toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no resizable=no, copyhistory=no, width=400, height=300');</script>";
			echo "<div align='center' class='left_navbox_form_text_title'>
		 <img src='../images/bussiness.jpg' alt='house_hand' id='main_img'/>
			<br />
    		 We encountered an error while processing your request please contact us at 1-800-273-5546
    			<br />
		 If a new window did not open please 
		 	<br />
		 <A href='../index.php' 'target=_blank' class='navlink'>Click here to go back to 18002SellHomes.com home page.</A>
		 </div>";	
		 die();
}	 
}
?>

 

Here is the code where it should delete the cookies

 

 

    
   <?php 
   				
		setcookie("Name", "", time() - 3600);
		setcookie("Area_Code", "", time() - 3600);
		setcookie("phone_prefix", "", time() - 3600);
		setcookie("phone_code", "", time() - 3600);
		setcookie("Mobile_Area_Code", "", time() - 3600);
		setcookie("mobile_phone_prefix", "", time() - 3600);
		setcookie("mobile_phone_code", "", time() - 3600);
		setcookie("Best_Time", "", time() - 3600);
		setcookie("Email", "", time() - 3600);
		setcookie("house_number", "", time() - 3600);
		setcookie("Street_Name", "", time() - 3600);
		setcookie("City", "", time() - 3600);
		setcookie("State", "", time() - 3600);;
		setcookie("County", "", time() - 3600);
		setcookie("County", "", time() - 3600);
		setcookie("Zip", "", time() - 3600);
		setcookie("Property_Information", "", time() - 3600);
		setcookie("Referral", "", time() - 3600);
		setcookie("Referral_other", "", time() - 3600);
		setcookie("Owner_Select", "", time() - 3600);
		setcookie("Owner_Name", "", time() - 3600);
		setcookie("Quickly_Sell", "", time() - 3600);
		setcookie("Why_Sell", "", time() - 3600);
		setcookie("Type_Property", "", time() - 3600);
		setcookie("Property_Condition", "", time() - 3600);
		setcookie("Property_Value", "", time() - 3600);
		setcookie("Accept_Quick_Sale", "", time() - 3600);
		setcookie("Square_Footage", "", time() - 3600);
		setcookie("Number_Bedrooms", "", time() - 3600);
		setcookie("Number_Bathrooms", "", time() - 3600);
		setcookie("Property_Age", "", time() - 3600);
		setcookie("Property_Occupied", "", time() - 3600);
		setcookie("Realtor", "", time() - 3600);
		setcookie("Mortgage_Balance", "", time() - 3600);
		setcookie("Monthly_Payment", "", time() - 3600);
		setcookie("Current_Payments", "", time() - 3600);
		setcookie("Second_Mortgage_Balance", "", time() - 3600);		

		if (isset($deletecookie)) {
$res = deletecookie($deletecookie);
if ($res) {
	header("Location: $PHP_SELF");
} else {
	echo "There was an error.";
}
}
   
   
   print_r($_COOKIE); 
   
   ?>

Why are you storing all that in a cookie?

 

Use sessions, soo much easier man.

Why are you storing all that in a cookie?

 

Use sessions, soo much easier man.

 

That is just the way I learned it but if you say so I will deff look into it. Any ideas why its only sending every other email?

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.