Hi Jeremy,
it's always easier for us if you tab/organize the code a bit so we get the 
overview. like this:


$result = @mysql_query($sql,$connection) or die("Couldn't execute query.");
 while ($row = mysql_fetch_array($result)) 
        {
        $uid = $row['uid']
        $team = $row['team'];
        $option_block .= "<option value=\"$uid\">$team</option>";
        }

$display_block = "<FORM METHOD=\"post\" ACTION=\"show_makeapick.php\">
                                        <P><strong>Team:</strong>
                                        <select name=\"uid\">
                                        $option_block
                                        </select>
                                        <INPUT TYPE=\"SUBMIT\" NAME=\"submit\" 
                                                VALUE=\"Select this Team\"></P>
                                        </form>
                                ";


I find the way you use the uid in various ways confusing. 

You use it as the name of the select object, and in the query and it is 
possible that this also is unclear when you use the $uid in the next page. 
Maybe it is the right choice at first but maybe if you print the form again 
in the result page, or for some other reason do a query like the above 
before you read the result, the $uid may be overridden and obviously the 
value is then set to the last team.

Please have a look at that. 
Also, could you please give us an example of the select part in the HTML 
page? just the part between <select name=uid> and </select>.


Sidestep
I don't remember why but in a code page i made recently i named every 
option. No idea if that is proper coding but it's worth a try:

        $option_block .= "<option name=\"uid\" value=\"$uid\">$team</option>";

(note that the name is a fixed name uid and is independent from the variable 
uid, and again, i would like you to rename it!)



hope this helps,

Chris








Antwoord naar:          <[EMAIL PROTECTED]>
Van:                    "Jeremy Morano" <[EMAIL PROTECTED]>
Aan:                    <[EMAIL PROTECTED]>
Datum verz.             Thu, 23 Aug 2001 11:10:25 -0400
Onderwerp:              [PHP] always last

> Hi,  I need a little bit of help.
> My variable $team in the option block is always set to the last variable that
> is read....I would like it to contain the option that the user
> clicks.....Please help me!
> 
> 
> 
> My Select works properly
> 
> ...
> 
> 
> $result = @mysql_query($sql,$connection) or die("Couldn't execute query.");
> 
> 
> while ($row = mysql_fetch_array($result)) {
> $uid = $row['uid']
> $team = $row['team'];
> 
> 
>  $option_block .= "<option value=\"$uid\">$team</option>";
> }
> 
> $display_block = "
> 
> <FORM METHOD=\"post\" ACTION=\"show_makeapick.php\">
> 
> <P><strong>Team:</strong>
> <select name=\"uid\">
> $option_block
> </select>
> 
> <INPUT TYPE=\"SUBMIT\" NAME=\"submit\" VALUE=\"Select this Team\"></P>
> </form>
> 
> ";
> 
> ?>
> 
> <HTML>
> <HEAD>
> <TITLE>User Management: Modify a User</TITLE>
> </HEAD>
> <BODY>
> <h1>User Management</h1>
> <h2><em>Modify a User</em></h2>
> <P>Select a contact from the list below, to modify the user's record.</p>
> 
> <? echo "$display_block"; ?>
> 
> <p><a href="contact_menu3.php">Return to Main Menu</a></p>
> 
> </BODY>
> </HTML>
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 



--------------------------------------------------------------------
--  C.Hayes  Droevendaal 35  6708 PB Wageningen  the Netherlands  --
--------------------------------------------------------------------

 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to