Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

PHP form processing - foreach  $_POST input field

Posted on 2009-06-29
3
Medium Priority
?
398 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 1000 total points
ID: 24741386
extract($_POST);
$namelist = "";
foreach($namelist as $value)
  {
  $namelist .= "$value, ";
  }
0
 
LVL 18

Assisted Solution

by:Hube02
Hube02 earned 1000 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

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‚Ķ
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 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.
Suggested Courses

604 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