|
Posted by Ivαn Sαnchez Ortega on 06/14/07 12:31
jsd219 wrote:
> Honestly i am not sure, i am a newbie with php and one of the other
> guys on this board give my that sting to use. I only had to modify it
> a bit so i haven't questioned it much. unfortunately i am now having
> problems with it. I am trying to learn. If you could explain what is
> coded wrong and why i would really appreciate it
Well, I wanted you to think a bit instead of giving you the solution.
See, a typical <select> is something like:
<select ... >
<option ...> ... </option>
<option ...> ... </option>
<option ...> ... </option>
<option ...> ... </option>
</select>
So the code structure has to be something like:
echo "<select ... >";
while (whatever)
{
echo "<option ... > ... </option>";
}
echo "</select>";
In your case, you were doing something like:
while (mysql_fetch_array()
{
echo "<select ...>";
while (mysql_fetch_array())
{
echo "<option ... > </option>";
}
}
Your code was fetching a row, DO NOTHING WITH IT, echo the <select>, and
then echo()ing the rest of the rows. Do you see the problem now?
--
----------------------------------
IvΓ‘n SΓ‘nchez Ortega -ivansanchez-algarroba-escomposlinux-punto-org-
He hath eaten me out of house and home.
-- William Shakespeare, "Henry IV"
Navigation:
[Reply to this message]
|