RE: [PHP-WIN] FORMS, hidden element and passing data to next page...
| From: | HKG) | Date: | Tue, 22 Apr 2003 15:17:30 +0000 |
| Subject: | RE: [PHP-WIN] FORMS, hidden element and passing data to next page... | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-19553@lists.php.net to get a copy of this message | ||
Why do you want to bounce information you already know
back and forth between the client and thew server?
(Or did I miss something here, if so just forget
about the rest of this message.)
The idea of posting information is to cut down the available
information set. That is to enrich the information content.
decrease entropy, make a decision, etc, etc, etc... "Kart barn
har manga namn" (Bellowed kid has several name) as the saying
goes in Swedish.
By submitting hidden fields you don't actually "learn" anything
new from the previous state of the web pages. So this information
could as well be kept as server side session persistent variables
instead of being sent back and forward; provided you are using
sessions; which you should prefere to do due to security reasons.
Which is: nothing prevents a hidden variables to be altered at
the client side before sent back to the server.
So if you really, really, really does not need to
bounce the information, do not do it.
//Anders
> -----Original Message-----
> From: Leo G. Divingracia III [mailto:ldivinag@csuhayward.edu]
> Sent: Tuesday, April 22, 2003 5:58 AM
> To: php-windows@lists.php.net
> Subject: [PHP-WIN] FORMS, hidden element and passing data to next
> page...
>
>
>
> 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
>