How to post values into an array from a select list
I have a question about arrays.
For example, I have a select pull down list with like 10-items. A user can make a selection and click SUBMIT and I want the value selected to be stored in an array.
Supposing the user does the above like thrice, I would want the three selections to be stored in an array. How do I do this?
I am able to post a selection into an array, but if the user makes a new selection and hits the submit button, the previous value is replaced.
Pls how do I do the above.
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
As NogDog says, you'd most likely want to use sessions. This can be accomplished by submitting your form to a php script that adds the values into a session array.
<form method="post" action="process.php">
<input type="text" name="field1" />
<input type="submit" value="Send!" />
$_SESSION['field1_val'] = $_POST['field1']; // This value can now be accessed on PHP pages.
// Nothing can be outputted before this point or you'll get errors.
// Basically don't try to echo stuff. :P
echo 'This is the final destination after submitting the form.<br />';
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)