Getting Form to Function Properly

Hi,

I have a form that I am having trouble functioning properly. Some of the form is fill in and another part is variable answers (i believe this is where it is hung up but i am stuck on figuring that out). If you can provide some pointers on where it is getting hung up, that would be very much appreciated.

Here is the form:
[php]

Input Your Information
* Name
* Email
* Phone
* Street Address
* City
* State
* Zip
Property Information
* How many Bedrooms
* How many Bathrooms
Approx. Square Footage
How many car Garage
Property Type Single Family Home Multi-Family Home Townhouse/Condo
When do you Plan to Sell your Home Immediately Within 2 mo Within 6 mo Within 1 yr Undecided
Listing Status Not Currently Listed Yes-For Sale by Owner Yes-With an Agent
Comments Comments:
clear
[/php]

Here is the PHP:
[php]<?php
if(isset($_POST[‘Name’],$_POST[‘E-Mail’],$_POST[‘Phone’],$_POST[‘Street-Address’],$_POST[‘City’],$_POST[‘State’],$_POST[‘Zip’],$_POST[‘How Many Bedrooms’],$_POST[‘How Many Bathrooms’],$_POST[‘Approx. Square Footage’],$_POST[‘How Many Car Garage’],$_POST[‘Property Type’],$_POST[‘When Do You Plan To Sell Your Home’],$_POST[‘Listing Status’],$_POST[‘Comments’]))
{
$Name = $_POST[‘Name’];
$E_Mail = $_POST[‘E-Mail’];
$Phone = $_POST[‘Phone’];
$Street_Adddress = $_POST[‘Street-Address’];
$City = $_POST[‘City’];
$State = $_POST[‘State’];
$Zip = $_POST[‘Zip’];
$How Many Bedrooms = $_POST[‘How Many Bedrooms’];
$How Many Bathrooms = $_POST[‘How Many Bathrooms’];
$Approx Square Footage = $_POST[‘Approx. Square Footage’];
$How Many Car Garage = $_POST[‘How Many Car Garage’];
$varProperty_Type = $_POST[‘Property-Type’];
$varWhen Do You Plan To Sell Your Home = $_POST[‘WhenDoYouPlanToSellYourHome’];
$varListing Status = $_POST[‘Listing-Status’];
$Message = “$Name\r\n$E_Mail\r\n$Phone\r\n$Street_Address\r\n$City\r\n$State\r\n$Zip\r\n$How Many Bedrooms\r\n$How Many Bathrooms\r\n$Approx Square Footage\r\n$How Many Car Garage\r\n$varProperty_Type\r\n$varWhen Do You Plan To Sell Your Home\r\n$varListing Status\r\n\r\n\r\n”;
$Comments .= $_POST[‘Comments’];
$mail_to_send_to = "[email protected]";
$your_feedbackmail = "[email protected]";
$subject = “Home Valuation Request”;
$headers = “From: [email protected]” . “\r\n” . “Reply-To: $your_feedbackmail” . “\r\n” . “Name: $Name” . “\r\n” ;
$a = mail( $mail_to_send_to, “Website Home Valuation Request”, $Message, $headers );
}
else die(‘You did not enter all required information. Please go back and complete the form.’);
?>[/php]

First thing to try is commenting out the mail part and displaying the message on the page, for example:

[php] $Message = “$Name\r\n$E_Mail\r\n$Phone\r\n$Street_Address\r\n$City\r\n$State\r\n$Zip\r\n$How Many Bedrooms\r\n$How Many Bathrooms\r\n$Approx Square Footage\r\n$How Many Car Garage\r\n$varProperty_Type\r\n$varWhen Do You Plan To Sell Your Home\r\n$varListing Status\r\n\r\n\r\n”;

echo $Message;

//$Comments .= $_POST['Comments'];
//$mail_to_send_to = "[email protected]";
//$your_feedbackmail = "[email protected]";
//$subject = "Home Valuation Request";

// $headers = “From: [email protected]” . “\r\n” . “Reply-To: $your_feedbackmail” . “\r\n” . “Name: $Name” . “\r\n” ;
//$a = mail( $mail_to_send_to, “Website Home Valuation Request”, $Message, $headers );[/php]

That should help you track down where it’s going awry.

Hi Xerxes - It is still not loading and am not sure where to begin in trouble shooting it.

Any other thoughts you can send my way is appreciated!!

This might be your problem:

Your field name is:
[php][/php]

But here you referred to it as: ‘When Do You Plan To Sell Your Home’
[php]if(isset($_POST[‘Name’],$_POST[‘E-Mail’],$_POST[‘Phone’],$_POST[‘Street-Address’],$_POST[‘City’],$_POST[‘State’],$_POST[‘Zip’],$_POST[‘How Many Bedrooms’],$_POST[‘How Many Bathrooms’],$_POST[‘Approx. Square Footage’],$_POST[‘How Many Car Garage’],$_POST[‘Property Type’],$_POST[‘When Do You Plan To Sell Your Home’],$_POST[‘Listing Status’],$_POST[‘Comments’]))[/php]

Thanks for the tip Xerxes, I am still getting the “You did not enter all required information. Please go back and complete the form.” error.

Something else I noticed, you can’t have variable names with spaces in them like this:

[php]$How Many Bedrooms = $_POST[‘How Many Bedrooms’];[/php]

Try removing the spaces from all your variables like this:

[php]$HowManyBedrooms = $_POST[‘How Many Bedrooms’];[/php]

Also, I tried the form out on my PC and there were a number of issues, here it is working:

[php]

<?php if (isset($_POST["hidSubmit"])){ $Name = $_POST['Name']; $EMail = $_POST['Email']; $Phone = $_POST['Phone']; $StreetAdddress = $_POST['StreetAddress']; $City = $_POST['City']; $State = $_POST['State']; $Zip = $_POST['Zip']; $HowManyBedrooms = $_POST['Bedrooms']; $HowManyBathrooms = $_POST['Bathrooms']; $ApproxSquareFootage = $_POST['Footage']; $HowManyCarGarage = $_POST['Garage']; $varPropertyType = $_POST['PropertyType']; $varWhenDoYouPlanToSellYourHome = $_POST['WhenDoYouPlanToSellYourHome']; $varListingStatus = $_POST['Listing-Status']; if (($Name == "")or($EMail == "")or($Phone == "")or($StreetAdddress == "")or($City == "")or($State == "")or($Zip == "")or($HowManyBedrooms == "")or($HowManyBathrooms == "")or($ApproxSquareFootage == "")or($HowManyCarGarage == "")or($varPropertyType == "")or($varWhenDoYouPlanToSellYourHome == "")or($varListingStatus == "")){ die('You did not enter all required information. Please go back and complete the form.'); } else{ $Message = "$Name\r\n$EMail\r\n$Phone\r\n$StreetAdddress\r\n$City\r\n$State\r\n$Zip\r\n$HowManyBedrooms\r\n$HowManyBathrooms\r\n$ApproxSquareFootage\r\n$HowManyCarGarage\r\n$varPropertyType\r\n$varWhenDoYouPlanToSellYourHome\r\n$varListingStatus\r\n\r\n\r\n"; //$Comments .= $_POST['Comments']; //$mail_to_send_to = "[email protected]"; //$your_feedbackmail = "[email protected]"; //$subject = "Home Valuation Request"; //$headers = "From: [email protected]" . "\r\n" . "Reply-To: $your_feedbackmail" . "\r\n" . "Name: $Name" . "\r\n" ; //$a = mail( $mail_to_send_to, "Website Home Valuation Request", $Message, $headers ); echo $Message; } } ?>

[/php]

And the modified form:

[php]

Input Your Information
* Name
* Email
* Phone
* Street Address
* City
* State
* Zip
Property Information
* How many Bedrooms
* How many Bathrooms
Approx. Square Footage
How many car Garage
Property Type Single Family Home Multi-Family Home Townhouse/Condo
When do you Plan to Sell your Home Immediately Within 2 mo Within 6 mo Within 1 yr Undecided
Listing Status Not Currently Listed Yes-For Sale by Owner Yes-With an Agent
Comments Comments:
clear
[/php]
Sponsor our Newsletter | Privacy Policy | Terms of Service