Solved

PHP:

Posted on 2009-05-12
2
256 Views
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

0
Comment
Question by:ticallian
2 Comments
 
LVL 8

Accepted Solution

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

0
 

Author Closing Comment

by:ticallian
ID: 31580471
Perfect!
Thanks
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Introduction A frequently used term in Object-Oriented design is "SOLID" which is a mnemonic acronym that covers five principles of OO design.  These principles do not stand alone; there is interplay among them.  And they are not laws, merely princ…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
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…
Learn how to set-up custom confirmation messages to users who complete your Wufoo form. Include inputs from fields in your form, webpage redirects, and more with Wufoo’s confirmation options.

808 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