Jump to content

PHP form


weyes1

Recommended Posts

ok,

Here's the code.

<CENTER><TABLE WIDTH="540">

 

<TR>

 

<TD><FONT FACE="Arial" SIZE="-1">

 

<P><CENTER>

          </CENTER>

        </P>

<?

if ($name == "") {

print "There was an omission - <br><br>";

print "In order to mail an estimate to you, we need to have your name.<br><br>";

print "Please go back and fill in your name on the form.<br><br>";

print "<input type=\"button\" value=\"<-- Back\" onClick=\"history.go(-1)\">";

exit;

}

if ($address == "") {

print "There was an omission - <br><br>";

print "In order to mail an estimate to you, we need to have your complete mailing address.<br><br>";

print "Please go back and fill in your mailing address on the form.<br><br>";

print "<input type=\"button\" value=\"<-- Back\" onClick=\"history.go(-1)\">";

exit;

}

if ($city == "") {

print "There was an omission - <br><br>";

print "In order to mail an estimate to you, we need to have your complete mailing address.<br><br>";

print "Please go back and fill in the city of your mailing address on the form.<br><br>";

print "<input type=\"button\" value=\"<-- Back\" onClick=\"history.go(-1)\">";

exit;

}

if ($state == "") {

print "There was an omission - <br><br>";

print "In order to mail an estimate to you, we need to have your complete mailing address.<br><br>";

print "Please go back and fill in the State for your mailing address.<br><br>";

print "<input type=\"button\" value=\"<-- Back\" onClick=\"history.go(-1)\">";

exit;

}

if ($zip == "") {

print "There was an omission - <br><br>";

print "In order to mail an estimate to you, we need to have your complete mailing address.<br><br>";

print "Please go back and fill in the ZIP code of your mailing address.<br><br>";

print "<input type=\"button\" value=\"<-- Back\" onClick=\"history.go(-1)\">";

exit;

}

if ($building_type == "none") {

print "There was an omission - <br><br>";

print "In order to submit your an accurate estimate, we need to know the type of building.<br><br>";

print "Please go back and fill in the type of building you have.<br><br>";

print "<input type=\"button\" value=\"<-- Back\" onClick=\"history.go(-1)\">";

exit;

}

if ($roof_type == "none") {

print "There was an omission - <br><br>";

print "In order to submit your an accurate estimate, we need to know the type of roof on the building.<br><br>";

print "Please go back and fill in the type of roof the building has.<br><br>";

print "<input type=\"button\" value=\"<-- Back\" onClick=\"history.go(-1)\">";

exit;

}

if ($job_stories == "") {

print "There was an omission - <br><br>";

print "In order to submit your an accurate estimate, we need to know how many stories the building has.<br><br>";

print "Please go back and fill in the number of stories.<br><br>";

print "<input type=\"button\" value=\"<-- Back\" onClick=\"history.go(-1)\">";

exit;

}

if ($leak_now == "none") {

print "There was an omission - <br><br>";

print "In order to submit your an accurate estimate, we need to know is your roof now leaks.<br><br>";

print "Please go back and provide that information.<br><br>";

print "<input type=\"button\" value=\"<-- Back\" onClick=\"history.go(-1)\">";

exit;

}

if ($leak_now == "yes" && $leak_area == "") {

print "There was an omission - <br><br>";

print "Since the roof leaks, in order to provide an accurate estimate, we need to know where the roof leaks.<br><br>";

print "Please go back and provide that information.<br><br>";

print "<input type=\"button\" value=\"<-- Back\" onClick=\"history.go(-1)\">";

exit;

}

if ($job_address == "") {

$job_address = $address;

}

?>

 

<?

  $message = mail("[email protected]", "ESTIMATE REQUEST - $name", "Greetings, weyes1\n

\nYou have had an individual submit a quote request via your web site.\n\n

 

Details follow:\n\n

 

Contact Name - $name\n

Mailing Address - $address, $city, $state  $zip\n\n

 

Daytime phone - $day_phone\n

Evening phone - $eve_phone\n

Cellular phone - $cell_phone\n

(if a value is blank, it was not filled in by the customer)\n\n

 

Job Details:\n\n

 

Job Address - $job_address, $job_city, $job_state\n\n

 

Building Details:\n

Building Type - $building_type\n

Roof Type - $roof_type\n

Stories - $job_stories\n

Does the roof leak now? - $leak_now\n

If yes, where - $leak_area\n\n

 

Comments:\n\n

 

$comments\n\n

 

END OF INFORMATION - Your friendly Automated Web Clerk.");

if (!$message) {

print ("<b><font face=\"Arial, Helvetica, sans-serif\" color=\"#FF0000\">WARNING: Submission ");

    print ("failed! Please email <a href=\"mailto:[email protected]\">");

print ("Expert Roofing</a> to alert them of this error. Failure to do so may delay ");

print ("your estimate.</font></b>");

}

if ($message) {

print ("Your request has been mailed to weyes1.  Thank you for allowing us to service you.<br><br>");

print ("You may continue browsing our site by selecting from the links at the top of the page.");

}

?>

 

</FONT></TD>

 

</TR>

 

</TABLE></CENTER><BR><BR>

 

Link to comment
https://forums.phpfreaks.com/topic/48857-php-form/#findComment-239486
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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