Hi,
Please keep in mind that I am a newbie to PHP, however I have just solved
this same type of problem (for County, City, and Zip) as follows:
// COUNTY
print tr;
print td align=\right\b class=\highlightColor\*
/bCounty:/td;
print td align=\left\;
if ($countyX != ) { $county = $countyX; }
print select name=\countyChoice\
onChange=\window.location.href=document.$formname.countyChoice.options[docu
ment.$formname.countyChoice.selectedIndex].value\ ;
print broption value=\\ class=\fieldStyle\;
$result = mysql_query(SELECT county FROM $db2.alabama GROUP BY county
ORDER BY county;,$link);
while ($a_row =mysql_fetch_array ($result) )
{
$countySelect = $a_row[county];
print broption
value=\selleradmin.php?DP=$DPedit=$editIN=INcounty=$countySelectcountyX
=$countySelectformname=$formname\ class=\fieldStyle\;
if ($county == $countySelect) { print SELECTED; }
print $countySelect;
}
print /select;
print input type=\hidden\ name=\county\ value=\$county\;
print /td;
print /tr;
// CITY
print tr;
print td align=\right\b class=\highlightColor\* /bCity:/td;
print td align=\left\;
if ($cityX != ) { $city = $cityX; }
print select name=\cityChoice\
onChange=\window.location.href=document.$formname.cityChoice.options[docume
nt.$formname.cityChoice.selectedIndex].value\ ;
print broption value=\\ class=\fieldStyle\;
$result = mysql_query(SELECT city FROM $db2.alabama WHERE
county='$county' GROUP BY city;,$link);
while ($a_row =mysql_fetch_array ($result) )
{
$citySelect = $a_row[city];
print broption
value=\selleradmin.php?DP=$DPedit=$editIN=INcounty=$countycountyX=$coun
tycity=$citySelectcityX=$citySelecttitle=$titleformname=$formname\
class=\fieldStyle\;
if ($city == $citySelect) { print SELECTED; }
print $citySelect;
}
print /SELECT;
print input type=\hidden\ name=\city\ value=\$city\;
print /td;
print /tr;
// Zip
print tr;
print td align=\right\Zip:/td;
print td align=\left\;
print SELECT NAME=\zip\ value=\$zip\ class=\fieldStyle\;
print broption value=\\ class=\fieldStyle\;
$result = mysql_query(SELECT * FROM $db2.alabama WHERE
(county='$county' AND city='$city') GROUP BY zip;,$link);
while ($a_row =mysql_fetch_array ($result) )
{
$zipSelect = $a_row[zip];
print broption value=\$zipSelect\ class=\fieldStyle\;
if ($zip == $zipSelect) { print SELECTED; }
print $zipSelect;
}
print /SELECT;
print /td;
print /tr;
I hope this helps, and am very open to any feedback from more experienced
users as to how this may not be the best solution.
Jackie
- Original Message -
From: Tom Rogers
To: Mike Walth
Cc: [EMAIL PROTECTED]
Sent: Wednesday, June 11, 2003 8:19 PM
Subject: Re: [PHP] Generating Related Drop Down Boxes
Hi,
Thursday, June 12, 2003, 5:19:00 AM, you wrote:
MW Hello all:
MW I have searched the archives, and although I know this is probably there
can
MW not find it. I'm probably just not searching for the right subject.
Here
MW is what I am looking for.
MW I have a table with Location and Hotel, and another one with Hotel and
MW Accommodations. I need to generate the first drop down box with
locations.
MW Then when you select a location it will place the corresponding hotels
in
MW another drop down, when you select the hotel it will do the
accommodations.
MW What I am looking for is if anyone has a sample or any information how
to do
MW the drop downs that update themselves. If I can get a sample for one
I'm
MW sure I can figure the rest out.
MW As always, thank you for all your help.
MW Mike Walth
MW CinoFusion
Check this out
http://www.mattkruse.com/javascript/dynamicoptionlist/
--
regards,
Tom
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php