solidariti
09-23-2005, 03:44 AM
Below is a sample of my form in one function called show_Bundles_Drop_Down($action) I have another function called validate_forms($action) that uses a switch to determine which function to call. In this switch I will have a case for a form. Im using HEREDOC to display html. I'm having trouble implementing the validation. Could you show me an example please, if anyone can and how would I validate and make a drop down menu sticky so the value picked will be retained when it goes back to the form. I would like to so the errors on the same form aswell.
function show_Bundles_Drop_Down($action)
{
global $strTelno,$adsl_linetype,$adsl_example,$adsl_stage2,$adsl_singlepop3,$adsl_singledomainname,$adsl_so hopop3_1,$adsl_sohopop3_2,$adsl_sohopop3_3;
global $adsl_sohopop3_4,$adsl_sohopop3_5,$adsl_sohodomainname,$adsl_smepop3_1,$adsl_smepop3_2,$adsl_smepop3 _3,$adsl_smepop3_4;
global $adsl_smepop3_5,$adsl_smedomainname,$adsl_smedomainname,$adsl_virtualspace,$adsl_salutation,$adsl_fn ame,$adsl_sname,$adsl_email;
global $adsl_contactno,$adsl_position,$adsl_company,$adsl_premisename,$adsl_premiseno,$adsl_towncity,$adsl_ county,$adsl_postcode;
global $adsl_hardwaredelivery,$adsl_billing,$adsl_customerref,$adsl_dealerref;
global $adslinstall_contactno,$adslinstall_position,$adslinstall_company,$adslinstall_premisename,$adslinst all_premiseno,$adslinstall_towncity;
global $adslinstall_county,$adslinstall_postcode;
global $strTelno,$sdsl_linetype,$sdsl_example,$sdsl_stage2,$sdsl_singlepop3,$sdsl_singledomainname;
global $sdsl_sohopop3_1,$sdsl_sohopop3_2,$sdsl_sohopop3_3;
global $sdsl_sohopop3_4,$sdsl_sohopop3_5,$sdsl_sohodomainname,$sdsl_smepop3_1,$sdsl_smepop3_2,$sdsl_smepop3 _3,$sdsl_smepop3_4;
global $sdsl_smepop3_5,$sdsl_smedomainname,$sdsl_smedomainname,$sdsl_virtualspace,$sdsl_salutation,$sdsl_fn ame,$sdsl_sname,$sdsl_email;
global $sdsl_contactno,$sdsl_position,$sdsl_company,$sdsl_premisename,$sdsl_premiseno,$sdsl_county,$sdsl_to wncity,$sdsl_postcode;
global $sdsl_hardwaredelivery,$sdsl_billing;
global $sdslinstall_contactno,$sdslinstall_position,$sdslinstall_company,$sdslinstall_premisename,$sdslinst all_premiseno;
global $sdslinstall_county,$sdslinstall_towncity,$sdslinstall_postcode,$valid;
global $sdsl_dealerref,$sdsl_customerref;
if ($action == "adslform")
{
print
<<<SHOWBUNDLESDROPDOWN
<p>If you wish to proceed with ordering this broadband service please complete the fields below.
<br /><font color="red">Required fields are marked with an asterisk *. </font></p>
<table summary="ADSL Checker" class="supportissues">
<tbody>
<form name="adsldetails" method="post">
<input type="hidden" name="strTelno" value="$strTelno">
<tr>
<th>Confirmation of PSTN Number</th>
<td>
<input type="text" class="textsmallerconfirm" name="strTelno" value="$strTelno"> to be converted to ADSL
</td>
</tr>
<tr>
<th><label for="Tel No Check"><font color="red">*</font> Please confirm the service type of your telephone line</label></th>
<td>
<select class="textlinetype" name="adsl_linetype" size="1">
<option value=""> Please confirm Line Type... </option>
<option>PSTN</option>
<option>ISDN 2e</option>
<option>Home Highway</option>
<option>Business Highway</option>
</select>
</td>
</tr>
<tr>
<th><label for="bundle"><font color="red">*</font> Please select the bundle you require<br /> </th>
<td>
<select class="textbundles" name="adsl_example" size="1" onChange="redirect(this.options.selectedIndex)">
<option value="">Please select an appropiate bundle</option>
<option>Single Business User ADSL</option>
<option>SOHO ADSL bundle (5-10 users)</option>
<option>SME ADSL bundle (5-15 users)</option>
</select>
</td>
Thank you in advance
function show_Bundles_Drop_Down($action)
{
global $strTelno,$adsl_linetype,$adsl_example,$adsl_stage2,$adsl_singlepop3,$adsl_singledomainname,$adsl_so hopop3_1,$adsl_sohopop3_2,$adsl_sohopop3_3;
global $adsl_sohopop3_4,$adsl_sohopop3_5,$adsl_sohodomainname,$adsl_smepop3_1,$adsl_smepop3_2,$adsl_smepop3 _3,$adsl_smepop3_4;
global $adsl_smepop3_5,$adsl_smedomainname,$adsl_smedomainname,$adsl_virtualspace,$adsl_salutation,$adsl_fn ame,$adsl_sname,$adsl_email;
global $adsl_contactno,$adsl_position,$adsl_company,$adsl_premisename,$adsl_premiseno,$adsl_towncity,$adsl_ county,$adsl_postcode;
global $adsl_hardwaredelivery,$adsl_billing,$adsl_customerref,$adsl_dealerref;
global $adslinstall_contactno,$adslinstall_position,$adslinstall_company,$adslinstall_premisename,$adslinst all_premiseno,$adslinstall_towncity;
global $adslinstall_county,$adslinstall_postcode;
global $strTelno,$sdsl_linetype,$sdsl_example,$sdsl_stage2,$sdsl_singlepop3,$sdsl_singledomainname;
global $sdsl_sohopop3_1,$sdsl_sohopop3_2,$sdsl_sohopop3_3;
global $sdsl_sohopop3_4,$sdsl_sohopop3_5,$sdsl_sohodomainname,$sdsl_smepop3_1,$sdsl_smepop3_2,$sdsl_smepop3 _3,$sdsl_smepop3_4;
global $sdsl_smepop3_5,$sdsl_smedomainname,$sdsl_smedomainname,$sdsl_virtualspace,$sdsl_salutation,$sdsl_fn ame,$sdsl_sname,$sdsl_email;
global $sdsl_contactno,$sdsl_position,$sdsl_company,$sdsl_premisename,$sdsl_premiseno,$sdsl_county,$sdsl_to wncity,$sdsl_postcode;
global $sdsl_hardwaredelivery,$sdsl_billing;
global $sdslinstall_contactno,$sdslinstall_position,$sdslinstall_company,$sdslinstall_premisename,$sdslinst all_premiseno;
global $sdslinstall_county,$sdslinstall_towncity,$sdslinstall_postcode,$valid;
global $sdsl_dealerref,$sdsl_customerref;
if ($action == "adslform")
{
<<<SHOWBUNDLESDROPDOWN
<p>If you wish to proceed with ordering this broadband service please complete the fields below.
<br /><font color="red">Required fields are marked with an asterisk *. </font></p>
<table summary="ADSL Checker" class="supportissues">
<tbody>
<form name="adsldetails" method="post">
<input type="hidden" name="strTelno" value="$strTelno">
<tr>
<th>Confirmation of PSTN Number</th>
<td>
<input type="text" class="textsmallerconfirm" name="strTelno" value="$strTelno"> to be converted to ADSL
</td>
</tr>
<tr>
<th><label for="Tel No Check"><font color="red">*</font> Please confirm the service type of your telephone line</label></th>
<td>
<select class="textlinetype" name="adsl_linetype" size="1">
<option value=""> Please confirm Line Type... </option>
<option>PSTN</option>
<option>ISDN 2e</option>
<option>Home Highway</option>
<option>Business Highway</option>
</select>
</td>
</tr>
<tr>
<th><label for="bundle"><font color="red">*</font> Please select the bundle you require<br /> </th>
<td>
<select class="textbundles" name="adsl_example" size="1" onChange="redirect(this.options.selectedIndex)">
<option value="">Please select an appropiate bundle</option>
<option>Single Business User ADSL</option>
<option>SOHO ADSL bundle (5-10 users)</option>
<option>SME ADSL bundle (5-15 users)</option>
</select>
</td>
Thank you in advance