Posted on 2009-05-12
Last Modified: 2013-12-12
How can i create an array containing all field names and values from a posted form.      
I then need to save the array as a session for later use.

The code i have works for storing the field input names, just not their submitted values.

Thanks for any help
$fields = array();
foreach ($_POST as $field => $value){
	array_push($fields, $field); 
$_SESSION['fields'] = $fields;

Open in new window

Question by:ticallian
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

Accepted Solution

mostart earned 500 total points
ID: 24362991
try this:
$fields = array();
foreach ($_POST as $field => $value){
        $fields[$field] = $value; 
$_SESSION['fields'] = $fields;

Open in new window


Author Closing Comment

ID: 31580471

Featured Post

Percona Live Europe 2017 | Sep 25 - 27, 2017

The Percona Live Open Source Database Conference Europe 2017 is the premier event for the diverse and active European open source database community, as well as businesses that develop and use open source database software.

Question has a verified solution.

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

What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
This video teaches viewers how to create their own website using cPanel and Wordpress. Tutorial walks users through how to set up their own domain name from tools like Domain Registrar, Hosting Account, and Wordpress. More specifically, the order in…
The viewer will learn how to count occurrences of each item in an array.

627 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