Page 1 of 1

Quick PHP question

Posted: Tue Apr 01, 2003 4:59 pm
by josboogz
Hi all,

Was just wondering when posting a variable such as

<input name="" id="hidden" value="">

is it possible to obtain the id value similar to getting the name and value in the page that it is posted too?


Thanks for your time


Jose

Posted: Tue Apr 01, 2003 5:36 pm
by Sevengraff
i dont understand the question.

Posted: Tue Apr 01, 2003 5:53 pm
by m3mn0n
Yes it is possible to get variables from hidden form elements.

Here is an example:

Code: Select all

&lt;form action="" method="post"&gt;
&lt;input name="hidden" type="hidden" value="this is the hidden variable"&gt;
&lt;input type="submit" name="submit" value="Get the hidden variable"&gt;
&lt;/form&gt;
On the same page add the following within the body of the page:

Code: Select all

<?php
if ($submit){
echo "$hidden";
}
?>

Posted: Wed Apr 02, 2003 2:09 am
by twigletmac
You can't get the id attribute value through PHP because all that's in $_POST (or $_GET) is the name and value attribute information.

Why do you need the id as well?

Mac