Forum Moderators: coopster

Message Too Old, No Replies

Could use some help

php drop down menu echo

         

StarChaser

9:31 am on Aug 10, 2003 (gmt 0)

10+ Year Member



Hi:

Hopefully someone can help me.

I have a script that is basically an advanced address book. The script is written for referees to be able to show their availability for a season and their information, along with address phone email and things are all stored in a database.

I think i have the 'entering' portion of it fine. But, in the new user page, there are drop downs with selections to be made. I have managed to get the variables from the drop downs to post into the database. THIS IS CONFIRMED when i browse the database thru phpadmin, i see the variable entries.

Now, obviously, like everything in the world, plans change. There is a link in the admin section that allows the admin to 'edit' the user details.

I have my problems solved up to the point of echoing the variable data back into a drop down box.

Another words:

A user says On the 17th of Sept, I am available for PM Games.

The options when first entering the information in is:
N/A
PM

Obviously the value will be set to output what I wish. But the question is, how can i get it to allow the admin to edit the details and see that the user originally selected PM?

I am including a portion of the code that surrounds the 'edit' area of the php.

I hope that someone could help me with this, it was all going fine until this point.

Heres the portion of the code.
**********************************************

<td width="91">Sept 14</td>
<td width="186"><select name="select" id="select3">
<option value="N/A" selected>N/A</option>
<option value="AM">AM</option>
<option value="PM">PM</option>
<option value="All Day">All Day</option>
</select></td>

**********************************

How do i write the php around that to echo the variable in the database?

thanks

StarChaser

9:36 am on Aug 10, 2003 (gmt 0)

10+ Year Member



just a little add on after i sat reading that post

the variable is set to "select" in the table of the database...just wondering if the "id" may be throwing it off?

thanks

vincevincevince

10:47 am on Aug 10, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



A solution to a similar problem I wrote a while ago. If you have trouble adapting it, then ask and I'll sort it out for you.


<SELECT NAME=\"section\">";
$h=mysql_query("SELECT specialismid,longname FROM specialisms WHERE 1");
while ($r=mysql_fetch_row($h))
{
$out=$out."<OPTION id=\"\" value=\"$r[0]\">$r[1]";
}
$out=$out."</SELECT>";
echo $out;