PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
ianhull
Forum Contributor
Posts: 310 Joined: Tue Jun 14, 2005 10:04 am
Location: Hull England UK
Post
by ianhull » Sun Sep 10, 2006 9:38 pm
Hi Guys,
A quick question.
Is it possible to retrieve the values of posted form fields if you do not know the name of the input or select box but you know the form name?
Code: Select all
<form id="form1" name="iknowthisname" method="post" action="">
</form>
Thanks in advance.
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Sun Sep 10, 2006 9:51 pm
The form name is not transmitted. You can look through the $_POST superglobal for the fields submitted.
nickman013
Forum Regular
Posts: 764 Joined: Sun Aug 14, 2005 12:02 am
Location: Long Island, New York
Post
by nickman013 » Sun Sep 10, 2006 11:01 pm
Its not possible. To get the value, you need to know the name.
Todd_Z
Forum Regular
Posts: 708 Joined: Thu Nov 25, 2004 9:53 pm
Location: U Michigan
Post
by Todd_Z » Mon Sep 11, 2006 12:16 am
Code: Select all
foreach ( $_POST as $key => $val )
echo "<p>{$key}: {$val}</p>";