|
Posted by Rik Wasmus on 10/14/07 11:37
On Sun, 14 Oct 2007 13:13:30 +0200, <william.hooper@gmail.com> wrote:
> If I have a form:
>
> <FORM ACTION=3D"test.php"><INPUT TYPE=3DSUBMIT NAME=3D"hello"
> VALUE=3D"Delete"> </FORM>
>
> then in test.php I could write:
>
> $value =3D $_POST['hello'];
>
> to set $value=3D"Delete".
>
> But what if I wanted to get "hello" out instead of "Delete". Ie how
> can I tell the variables inside the porm submit instead of just the
> values of the variables?
>
> Many Thanks... I am new to PHP and can not find this info despite
> searching around for a while!
Examining the $_POST array.
So, for instance:
<?php
if(!empty($_POST)){
foreach($_POST as $key =3D> $value){
//'hello' should be a key:
echo ""$key:$value\n";
}
}
?>
If you only want the array keys, use array_keys($_POST) for that.
-- =
Rik Wasmus
Navigation:
[Reply to this message]
|