Hello everyone!
I'm writing a script that will take orders for a hosting company and i'm trying to figure out a better way to handle the errors that happen if the orderer doesn't fill in something or whatever. Here is what I have:
if ($FORM{'submit_order'}) {
if ($FORM{'package'} eq "select") { &error_order_form("<li>You need to select a Hosting Package</li>") }
if (!$FORM{'username'}) { &error_order_form("<li>You need to enter a Client's Area Username</li>") }
if (!$FORM{'password'}) { &error_order_form("<li>You need to enter a Client's Area Password</li>") }
if (!$FORM{'name'}) { &error_order_form("<li>You need to enter your Name</li>") }
if (!$FORM{'business_name'}) { &error_order_form("<li>You need to enter your Business / Organization Name</li>") }
if (!$FORM{'email'}) { &error_order_form("<li>You need to enter your E-mail Address</li>") }
if (!$FORM{'address'}) { &error_order_form("<li>You need to enter your Street Address</li>") }
if (!$FORM{'city'}) { &error_order_form("<li>You need to enter your City</li>") }
if (!$FORM{'state'}) { &error_order_form("<li>You need to enter your State</li>") }
if (!$FORM{'zipcode'}) { &error_order_form("<li>You need to enter your Zip Code</li>") }
if (!$FORM{'email'}) { &error_order_form("<li>You need to enter your E-mail Address</li>") }
else {
blah blah blah...
&order_has_been_taken;
}
}
else { &clean_order_form; }
as you can see, if an error happens, it prints the &error_order_form; subroutine with the whatever message but I quickly realized that the way i have it will print the subroutine for every error. I could just put elsif but it will only display one error message and then the next one after the orderer has fixed it and clicked submit. I want it to display all the error messages that occured in an unordered list, like I have it setup and like Links. So all i'm asking for is another way to handle these error that will display all the errors on the &error_order_form;. For general info, it is setup like Links: &clean_order_form; shows the order form; &error_order_form; display the form and whatever errors happened; and &order_has_been_taken; displays the done page.
Thanks a bunch and God bless!
<><------------><>
Daniel
http://www.christian-search.net
<><------------><>
I'm writing a script that will take orders for a hosting company and i'm trying to figure out a better way to handle the errors that happen if the orderer doesn't fill in something or whatever. Here is what I have:
if ($FORM{'submit_order'}) {
if ($FORM{'package'} eq "select") { &error_order_form("<li>You need to select a Hosting Package</li>") }
if (!$FORM{'username'}) { &error_order_form("<li>You need to enter a Client's Area Username</li>") }
if (!$FORM{'password'}) { &error_order_form("<li>You need to enter a Client's Area Password</li>") }
if (!$FORM{'name'}) { &error_order_form("<li>You need to enter your Name</li>") }
if (!$FORM{'business_name'}) { &error_order_form("<li>You need to enter your Business / Organization Name</li>") }
if (!$FORM{'email'}) { &error_order_form("<li>You need to enter your E-mail Address</li>") }
if (!$FORM{'address'}) { &error_order_form("<li>You need to enter your Street Address</li>") }
if (!$FORM{'city'}) { &error_order_form("<li>You need to enter your City</li>") }
if (!$FORM{'state'}) { &error_order_form("<li>You need to enter your State</li>") }
if (!$FORM{'zipcode'}) { &error_order_form("<li>You need to enter your Zip Code</li>") }
if (!$FORM{'email'}) { &error_order_form("<li>You need to enter your E-mail Address</li>") }
else {
blah blah blah...
&order_has_been_taken;
}
}
else { &clean_order_form; }
as you can see, if an error happens, it prints the &error_order_form; subroutine with the whatever message but I quickly realized that the way i have it will print the subroutine for every error. I could just put elsif but it will only display one error message and then the next one after the orderer has fixed it and clicked submit. I want it to display all the error messages that occured in an unordered list, like I have it setup and like Links. So all i'm asking for is another way to handle these error that will display all the errors on the &error_order_form;. For general info, it is setup like Links: &clean_order_form; shows the order form; &error_order_form; display the form and whatever errors happened; and &order_has_been_taken; displays the done page.
Thanks a bunch and God bless!
<><------------><>
Daniel
http://www.christian-search.net
<><------------><>