Solved

Get all the $_post

Posted on 2009-05-04
3
216 Views
Last Modified: 2012-05-06
How can i retrieve all variables posted through $_post
i dont know how many will be passed everytime the post is submitted i only
know they will be named like this:
itemid_456
itemid_7874
itemid_4841
itemid_4843
etc...
0
Comment
Question by:CMDAI
3 Comments
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
Comment Utility
you can loop in the $_POST array... and then check the key name
foreach($_POST as $key => $value)
{
   // check name here, using $key value
 
}

Open in new window

0
 
LVL 4

Expert Comment

by:max-hb
Comment Utility
Maybe simply iterate through all available post vars?!

<?php
echo "<pre>";
foreach($_POST as $key => $value) {
  echo "Variable $key has value(s):<br/>";
  print_r($value);
}
?>
Regards
 Marc

0
 
LVL 1

Author Closing Comment

by:CMDAI
Comment Utility
thanks
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
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…
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 create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

743 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

14 Experts available now in Live!

Get 1:1 Help Now