Solved

PHP form processing - foreach  $_POST input field

Posted on 2009-06-29
3
384 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

These days socially coordinated efforts have turned into a critical requirement for enterprises.
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

733 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