I wrote a script that is supposed to e-mail me the results of a form. When I get the message the variables in the message are not there. I discovered that the variables were only not working in the "buyer()" function in my script. Can somebody help me?
<?php
//The name variable works here
echo "$Name 1 <br>";
$messagetype = "buyer";
switch($messagetype)
{
case "buyer":
echo "$Name 2<br>";
buyer();
break;
case "seller":
seller();
break;
case "general":
general();
break;
default:
echo "Invalid Message Type";
break;
}
//The name variable works here when I
//make the switch statment go to defualt
function buyer()
{
//The name variable does not work here
echo "$Name 3<br>";
$sendto = "frankprogramer@earthlink.net";
$subject = "Buyer Request";
$message = "Name : $name \n
Address : $Address \n
City : $City \n
State : $State \n
Zip : $Zip \n
Phone : $Phone \n
Fax : $FAX \n
E-mail : $E-mail \n
Property Type -\n
Residential : $Residential\n
Commercial : $Commercial \n
Land : $Land \n
Investment : $Investment\n
Specific Requirements -
Area/s Interested in : $AreasInterestedIn\n
of Bedrooms : $Bedrooms \n
of Baths : $Baths \n
of Square Feet : $SQFT\n
Car Garage : $CarGarage \n
Price Range : $PriceRange \n
Other Requirements : $OtherRequirements
Comments : $Comments \n
";
//The name variable does not work here
echo $Name;
mail($sendto, $subject, $message);
exit;
}
The variables will not work anywhere in the buyer function. Please Help.