View Single Post
  #1  
Old 08-17-2006, 02:13 PM
madmax madmax is offline
OSP Starters
 
Join Date: Aug 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
madmax is on a distinguished road
Thumbs down Autofilling dropdown box

Hello all

I am trying to autofill a dropdown list and am not sure how to construct it, I got this far:

[php]
if(($_GET['vehicle_type'] == 'Ford')){

$query = mysql_query("SELECT vehicle_make FROM vehicles WHERE vehicle_type='Ford'"); // autofill dropdown list 'select' with options from DB
$r = mysql_fetch_array($query);

$size=explode(',', $r['vehicle_make']);
for($i=0;$vehicle_make[$i];$i++)
{
echo "<option value=$vehicle_make[$i]>$vehicle_make[$i]</option>";
}
}

[php]

the resulty is no options in the dropdown box ? -- This message may have been cut off and the rest will only be shown to members. To become a member, click here --
Reply With Quote
  Webmaster Forums - View Single Post - Autofilling dropdown box
View Single Post
  #1  
Old 08-17-2006, 02:13 PM
madmax madmax is offline
OSP Starters
 
Join Date: Aug 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
madmax is on a distinguished road
Thumbs down Autofilling dropdown box

Hello all

I am trying to autofill a dropdown list and am not sure how to construct it, I got this far:

[php]
if(($_GET['vehicle_type'] == 'Ford')){

$query = mysql_query("SELECT vehicle_make FROM vehicles WHERE vehicle_type='Ford'"); // autofill dropdown list 'select' with options from DB
$r = mysql_fetch_array($query);

$size=explode(',', $r['vehicle_make']);
for($i=0;$vehicle_make[$i];$i++)
{
echo "<option value=$vehicle_make[$i]>$vehicle_make[$i]</option>";
}
}

[php]

the resulty is no options in the dropdown box ? -- This message may have been cut off and the rest will only be shown to members. To become a member, click here --
Reply With Quote