Solved

PHP form processing - foreach  $_POST input field

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
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.

773 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