Solved

PHP form processing - foreach  $_POST input field

Posted on 2009-06-29
3
371 Views
Last Modified: 2012-05-07
How do i go thru each input field that was submitted,  and access the fieldname and its value?

foreach  ($_POST)
{
  echo "FieldName = $xxx  --
       Value= $yyy <br>
       ";
}
0
Comment
Question by:willsherwood
3 Comments
 
LVL 28

Accepted Solution

by:
gamebits earned 250 total points
ID: 24741386
extract($_POST);
$namelist = "";
foreach($namelist as $value)
  {
  $namelist .= "$value, ";
  }
0
 
LVL 18

Assisted Solution

by:Hube02
Hube02 earned 250 total points
ID: 24741396
Or you could do the loop on $_POST itself.
foreach ($_POST as $key => $value) {

  // $key contains field name

  // $value contains the value of the field

}

Open in new window

0
 

Author Closing Comment

by:willsherwood
ID: 31598189
perfect, thanks all!
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
This article discusses four methods for overlaying images in a container on a web page
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now