Forum Moderators: coopster
I have on my site a form with 1 input field && 1 submit button and 1 "Next" button to stop and redirect the site, where I can write strings up to 50 chars down (special chars allowed!).
After sending the form I need to have the ability to write some next string and display all my input ordered list like.
How can I in a very simple way continuosly save the form data in a ordinary indexed array?
Thanx in advance for your answers...
greeetz
Redbanditos2005
You might want to start looking in the PHP Manual [uk.php.net] for info about sessions.
Basically a session is a way of uniquely identifying a certain user, usually through a 32byte session ID. It can be passed along through a cookie or URL through subsequent pages so you can keep track of this user (or any data associated with them).
The manual contains enough to get started on them .....
<input type="text" name="var[]">
<input type="text" name="var[]">
<input type="text" name="var[]">
<input type="text" name="var[]">
In this example you will get an array named $_REQUEST['var'] in PHP that is an array of all the form items.
daisho.
The thing is:
I need to save in mysql (Im working with phplib already) user inputs like textdocument titles.
So I want to do it with 1 textfield for the inputs, 1 "submit" button for sending it to $PHP_SELF, saving it continously in an array for later saving in mysql after clicking on 1 "next" button.
The array data should also be continously displayed above the form as a ordered list.
I dont have much experience in PHP-coding, so Im not sure if its possibile to do it in the way described above...
When they hit the submit button you write to the db and then select the whole list from the db. Sort it and display it.
PHP MySQL Functions [ca.php.net]
sort() [ca.php.net] for sorting your array, there are also many other sort functions listed on this page.
In fact I was searching for some people who may have managed similar problem, but this cannot be done with only 1 textfield. Not only with HTML and PHP funcionality I think :-(( (except you're the best hacker on Earth ;-D)
So I made a "textfield list" with 1 "Add" and 1 "Delete" button for adding and deleting the content of the array and it works fine ;-)
pseudocode:
register session
read form data (if present), add to session variable
echo the form (form action to $PHPSELF)
that would do the job