Link to home
Start Free TrialLog in
Avatar of pingeyeg
pingeyeg

asked on

Result not happening like it should

I have the following code that should be calling the variable $result once the condition is met, but it doesn't seem to be happening.
<?php
 
if($_POST['Submit']) {
	$beds = $_POST['strBeds'];
	$baths = $_POST['strBaths'];
	$lowprice = $_POST['strLowPrice'];
	$maxprice = $_POST['strMaxPrice'];
	$name = $_POST['strName'];
	$email = $_POST['strEmail'];
	
	$to = 'brannon@goodboyweb.com';
	$subject = "$name is looking for homes with the following criteria";
	$message = "<table width='200px' cellpadding='5' cellspacing='0'>\r\n";
	$message .= "<tr><td>\r\n";
	$message .= "Price range is from $" . $lowprice . " to $" . $maxprice . "</td></tr>\r\n";
	$message .= "<tr><td>Number of beds is $beds</td></tr>\r\n";
	$message .= "<tr><td>Number of baths is $baths</td></tr>\r\n";
	$message .= "<tr><td>My name is $name</td></tr>\r\n";
	$message .= "<tr><td>My e-mail address is $email</td></tr></table>\r\n";
	$headers = 'From: ' . $strEmail;
	
if(mail($to,$subject,$message,$headers)) {
	$result = "Thank you for your requirements.  We will contact you soon.";
} else {
	$result = "There was a problem with this form.  Please let us know.";
}
}
 
?>
<tr><form action="<?php echo $_SERVER['PHP_SELF'] ?>" method="post"><td align="center">
<div style="margin-top: 5px; margin-bottom: 10px">
<img src="images/newsletter_title.png">
</div>
<div class="form">
Let us know what you are looking for and one of our agents will glady help make it a reality.
</div>
<div style="margin-top: 5px">
<?php if(isset($_POST['Submit'])) { 
				echo $result;
		} else {
?>
<select name="strBeds">
<option default="default">Beds</option>
<option value="1+ Beds">1+ Beds</option>
<option value="2+ Beds">2+ Beds</option>
<option value="3+ Beds">3+ Beds</option>
<option value="4+ Beds">4+ Beds</option>
<option value="5+ Beds">5+ Beds</option>
</select>
&nbsp;
<select name="strBaths">
<option default="default">Baths</option>
<option value="1+ Bath">1+ Bath</option>
<option value="1.5+ Baths">1.5+ Baths</option>
<option value="2+ Baths">2+ Baths</option>
<option value="2.5+ Baths">2.5+ Baths</option>
<option value="3+ Baths">3+ Baths</option>
<option value="3.5+ Baths">3.5+ Baths</option>
<option value="4+ Baths">4+ Baths</option>
</select>
</div>
<div style="margin-top: 5px">
<select name="strLowPrice">
<option default="default">Min Price</option>
<option value="$1,000">$1,000</option>
<option value="$5,000">$5,000</option>
<option value="$10,000">$10,000</option>
<option value="$20,000">$20,000</option>
<option value="$30,000">$30,000</option>
<option value="$40,000">$40,000</option>
<option value="$50,000">$50,000</option>
<option value="$100,000">$100,000</option>
<option value="$125,000">$125,000</option>
<option value="$150,000">$150,000</option>
<option value="$175,000">$175,000</option>
<option value="$200,000">$200,000</option>
<option value="$225,000">$225,000</option>
<option value="$250,000">$250,000</option>
<option value="$275,000">$275,000</option>
<option value="$300,000">$300,000</option>
<option value="$325,000">$325,000</option>
<option value="$350,000">$350,000</option>
<option value="$375,000">$375,000</option>
<option value="$400,000">$400,000</option>
<option value="$425,000">$425,000</option>
<option value="$450,000">$450,000</option>
<option value="$475,000">$475,000</option>
<option value="$500,000">$500,000</option>
<option value="$525,000">$525,000</option>
<option value="$550,000">$550,000</option>
<option value="$575,000">$575,000</option>
<option value="$600,000">$600,000</option>
<option value="$625,000">$625,000</option>
<option value="$650,000">$650,000</option>
<option value="$675,000">$675,000</option>
<option value="$700,000">$700,000</option>
<option value="$725,000">$725,000</option>
<option value="$750,000">$750,000</option>
<option value="$775,000">$775,000</option>
<option value="$800,000">$800,000</option>
<option value="$825,000">$825,000</option>
<option value="$850,000">$850,000</option>
<option value="$875,000">$875,000</option>
<option value="$900,000">$900,000</option>
<option value="$925,000">$925,000</option>
<option value="$950,000">$950,000</option>
<option value="$975,000">$975,000</option>
<option value="$1,000,000">$1,000,000</option>
</select>
&nbsp;
<select name="strMaxPrice">
<option default="default">Max Price</option>
<option value="$1,000">$1,000</option>
<option value="$5,000">$5,000</option>
<option value="$10,000">$10,000</option>
<option value="$20,000">$20,000</option>
<option value="$30,000">$30,000</option>
<option value="$40,000">$40,000</option>
<option value="$50,000">$50,000</option>
<option value="$100,000">$100,000</option>
<option value="$125,000">$125,000</option>
<option value="$150,000">$150,000</option>
<option value="$175,000">$175,000</option>
<option value="$200,000">$200,000</option>
<option value="$225,000">$225,000</option>
<option value="$250,000">$250,000</option>
<option value="$275,000">$275,000</option>
<option value="$300,000">$300,000</option>
<option value="$325,000">$325,000</option>
<option value="$350,000">$350,000</option>
<option value="$375,000">$375,000</option>
<option value="$400,000">$400,000</option>
<option value="$425,000">$425,000</option>
<option value="$450,000">$450,000</option>
<option value="$475,000">$475,000</option>
<option value="$500,000">$500,000</option>
<option value="$525,000">$525,000</option>
<option value="$550,000">$550,000</option>
<option value="$575,000">$575,000</option>
<option value="$600,000">$600,000</option>
<option value="$625,000">$625,000</option>
<option value="$650,000">$650,000</option>
<option value="$675,000">$675,000</option>
<option value="$700,000">$700,000</option>
<option value="$725,000">$725,000</option>
<option value="$750,000">$750,000</option>
<option value="$775,000">$775,000</option>
<option value="$800,000">$800,000</option>
<option value="$825,000">$825,000</option>
<option value="$850,000">$850,000</option>
<option value="$875,000">$875,000</option>
<option value="$900,000">$900,000</option>
<option value="$925,000">$925,000</option>
<option value="$950,000">$950,000</option>
<option value="$975,000">$975,000</option>
<option value="$1,000,000">$1,000,000</option>
</select>
</div>
<div align="left" class="form_line">
<span style="margin-left: 5px">Name:</span> <input type="text" class="input" name="strName" size="20" style="border: none">
</div>
<div align="left" class="form_line">
<span style="margin-left: 5px">E-mail:</span> <input type="text" class="input" name="strEmail" size="20" style="border: none">
</div>
<div style="margin-top: 3px; margin-bottom: 5px">
<input type="image" src="images/sendbtn.png" name="Submit"></div>
<?php } ?>

Open in new window

SOLUTION
Avatar of Michael701
Michael701
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of pingeyeg
pingeyeg

ASKER

LordOfPorts,

That worked, but now I have a button behind my image.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Perfect!