|
Posted by Ivαn Sαnchez Ortega on 05/03/07 15:32
cresh wrote:
> I can pull the data from the table using an array, no problems there.
> I can display the data, etc., just can't figure out how to put the
> data into a form <option> tag.
[...]
> Do you see what I'm trying to do now? I'm not sure if I'm making
> myself clear enough. $program[ ] is the variable to hold the
> information pulled from the database table.
In order to iterate through an array, do this:
<?php
foreach($program as $item)
{
echo "<option value='$item'>$item</option>";
}
?>
Or maybe you'd prefer something like this:
<?php
$r = mysql_query("select foo from baaz where foobar");
while($row = mysql_fetch_assoc($r))
{
echo "<option value='{$row['foo']}'>{$row['foo']}</option>";
}
?>
I hope you get the idea.
By the way, try to make your PHP blocks larger, and fewer in number - code
is more readable that way.
--
----------------------------------
IvΓ‘n SΓ‘nchez Ortega -ivansanchez-algarroba-escomposlinux-punto-org-
El clavo que sobresale siempre recibe un martillazo.
--Proverbio Chino
Navigation:
[Reply to this message]
|