Re: Re: FORMS, hidden element and passing data to next page...

From: Date: Tue, 22 Apr 2003 09:58:12 +0000
Subject: Re: Re: FORMS, hidden element and passing data to next page...
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-19545@lists.php.net to get a copy of this message
hay leo i think what u are trying to do is fetch a few values from the db and pass them on to the next page thru hidden fields if (my_thinkin==right){ // try this instead of all that u have done // for ($count=0; $count<mysql_num_rows(fetch query result handler); ++$count){ $fetch = mysql_fetch_row(fetch query result handler); $uzr_id = $fetch[0]; $lastname = $fetch[1] ; $firstname = $fetch[2] ; // the 1,2,3 are in the order u fetch these from the db table } // endda fetch row for <input type=hidden name=fname value='$uzr_id'></input> <input type=hidden name=fname value='$firstname'></input> <input type=hidden name=fname value='$lastname'></input> now heres the catch if ur fetchin more than a single set of values ull have to do $uzr_id[] = $fetch[0]; $lastname[] = $fetch[1] ; $firstname[] = $fetch[2] ; and pass these in an other for loop countz<=mysql_num_rows(query) <input type=hidden name=fname value='$uzr_id[countz]'></input> <input type=hidden name=fname value='$firstname[countz]'></input> <input type=hidden name=fname value='$lastname[countz]'></input> } // endda my thnk if :) i hope this solvez ur prob .... :) good luck toby --- Seairth Jacobs <seairth@seairth.com> wrote: > Are you sure that you are inserting a value in the hidden form > element? > View source in your browser and see if there is even a value. > Attempting to > access $res[] after the while() loop seems suspect. Or, if you are > trying > to have first_name contain the value of the first name of the > selected user, > you will have to do that with some Javascript in the onchange event > of the > SELECT or the onsubmit event of the FORM. > > > -- > --- > Seairth Jacobs > seairth@seairth.com > > > "Leo G. Divingracia III" <ldivinag@csuhayward.edu> wrote in message > news:3EA4BDC6.9030903@csuhayward.edu... > > > > okay, > > > > making a simple form but i wanna pass more than the data being > selected > > from the dropdown/select FORM element. for example: > > > > // TEST1.PHP > > // mysql connections code and stuff taken out. it works... > > echo ('<FORM ACTION="test2.php" METHOD=POST>'); > > echo ('<SELECT NAME="user_id">'); > > while ($res = mysql_fetch_row ($result)) > > { > > echo ('<OPTION VALUE='.$res[0].'>'.$res[1].', .$res[2]); > > } > > mysql_close ($link_id); > > echo (' </SELECT></P>'); > > echo ('<INPUT TYPE=hidden NAME="first_name" > > VALUE='.$res[2].'>'); > > echo ('<INPUT TYPE=submit NAME=Submit VALUE="Submit">'); > > > > > > $res[0] = id key of user > > $res[1] = lastname > > $res[2] = firstname > > > > > > // TEST2.PHP > > echo ('user id: '.$_POST[user_id]); > > echo ('first name: '.$_POST[first_name]); > > > > > > "user_id" comes out fine. but the "first_name" doesnt. am i > using the > > HIDDEN form type correctly? i guess i dont want to access the DB > again > > on TEST2.PHP. after all, in TEST1.PHP, i build the SELECT form > element > > from the DB. or is this the only way? the HIDDEN element doesnt > or > > cant receive the data correctly? > > > > thanks... > > -- > > Leo G. Divinagracia III > > ldivinag@csuhayward.edu > > > > zzzzz > > > > > > -- > PHP Windows Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > __________________________________________________ Yahoo! Plus For a better Internet experience http://www.yahoo.co.uk/btoffer

« previous php.windows (#19545) next »