Solved

PHP form processing - foreach  $_POST input field

Posted on 2009-06-29
3
381 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

790 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