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

From: Date: Tue, 22 Apr 2003 05:10:28 +0000
Subject: Re: FORMS, hidden element and passing data to next page...
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-19543@lists.php.net to get a copy of this message
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 >

« previous php.windows (#19543) next »