html post form question

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

Post Reply
ianhull
Forum Contributor
Posts: 310
Joined: Tue Jun 14, 2005 10:04 am
Location: Hull England UK

html post form question

Post by ianhull »

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.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

The form name is not transmitted. You can look through the $_POST superglobal for the fields submitted.
User avatar
nickman013
Forum Regular
Posts: 764
Joined: Sun Aug 14, 2005 12:02 am
Location: Long Island, New York

Post by nickman013 »

Its not possible. To get the value, you need to know the name.
User avatar
Todd_Z
Forum Regular
Posts: 708
Joined: Thu Nov 25, 2004 9:53 pm
Location: U Michigan

Post by Todd_Z »

Code: Select all

foreach ( $_POST as $key => $val )
  echo "<p>{$key}: {$val}</p>";
Post Reply