Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_php thread: re-visit SELECT problem


Message #1 by "Richard D. Williams" <appgrp@e...> on Mon, 26 Mar 2001 09:24:53 -0600
Richard,

It appears to just be an HTML error causing your unwanted results your 
second line provided below reads:

<OPTION SELECTED='$clsinstr'>$instrname</OPTION>");

which in fact it should read:

<OPTION VALUE='$clsinstr' SELECTED>$instrname</OPTION>");

I hope that helps.

Brian



At 09:24 AM 3/26/01 -0600, you wrote:
>This is a problem I thought was solved. It seems I still do get this
>technique.
>
>$clsinstr (instr id number) and $instrname (instructor name) are provided by
>a query above this point.
>I am trying to get $clsinstr into myinstrsel. This works if I actually
>select a value from the drop box.  But if I do not make a selection and
>accept the default selected value, myinstrsel ends up with the selected
>instructor name($instrname), not the instr id number ($clsinstr).
>
>echo ("  Instructor: <SELECT NAME='myinstrsel' SIZE='1'>
><OPTION SELECTED='$clsinstr'>$instrname</OPTION>");
>$queryE = "SELECT * FROM instr ORDER BY instr_name";
>$linkE = mysql_query($queryE) or die("<font color=red>Insert Failed! error-"
>
>. mysql_error() . "<br>\nquery - $queryE</font>");
>while ($myinstr = mysql_fetch_array($linkE)){
>       $instrname = $myinstr["instr_name"];
>       $instrid = $myinstr["instr_id"];
>       echo "<OPTION VALUE='$instrid'>$instrname</OPTION>";
>}
>echo ("</SELECT>");
>
>Any input here would be very welcome.  If the problem is not clear I would
>be happy to get more specific.
>
>Thanks
>
>Richard D. Williams
>
>
>

  Return to Index