Solved

PHP:

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Sort Multidimensional Array 11 34
Paypal 502 Error 3 70
A form to still have contents even if some are wrong 10 46
aws pricing 2 20
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…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
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.

911 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

22 Experts available now in Live!

Get 1:1 Help Now