i need to populate drop down box with database values. i have a field customername from table customer and i want a function that populates drop down in html with the values of this field. we have to use pear and it is making a little complicated
populate drop down box
Collapse
X
-
you dont have to use perl for this, i suppose
and populating a drop down is fairly easy in php.
[PHP]
1. connect and fetch data from database
2. store the result in an array .. say $result
now
echo "<select>
foreach($array as $data){
echo "<option>$d ata[customername]</option>";
}
echo "</select>";
[/PHP]
the above code should do the needful, i preassume that steps 1,2 are clear.
cheers !! -
i didn't mean perl i meant peardb but thank you your code was helpfulOriginally posted by realinyou dont have to use perl for this, i suppose
and populating a drop down is fairly easy in php.
[PHP]
1. connect and fetch data from database
2. store the result in an array .. say $result
now
echo "<select>
foreach($array as $data){
echo "<option>$d ata[customername]</option>";
}
echo "</select>";
[/PHP]
the above code should do the needful, i preassume that steps 1,2 are clear.
cheers !!Comment
Comment