...

View Full Version : Display Multiple Inputs from one Input field



deadman
09-14-2011, 07:49 PM
So i have a form in the file index.php


<form method="post" action="index.php">
<div id="name"><input type="text" name="name" size="10" /></div>
<input type="submit" name="submitted" value="Submit"/>
</form>


What i want to do is for every time the submit button is pressed, i can echo the first name that was submitted, and also echo the current name that was submitted.. and so on...

So for example:
Name: dead
hit submit
shows:
dead

name: man
hit submit
shows:
dead
man

I have a counter on my submit button already. I just cant get the inputs that where submitted before to show up.

Rowsdower!
09-14-2011, 08:23 PM
Look into PHP sessions (there is an array variable called $_SESSION that you can store such information in).

Otherwise, you can store previously submitted inputs with hidden inputs fields generated on the form page (if you are submitting the form to itself) and then just keep adding more hidden input elements to the form as you get more previously entered data to add.

deadman
09-14-2011, 10:01 PM
Look into PHP sessions (there is an array variable called $_SESSION that you can store such information in).

Otherwise, you can store previously submitted inputs with hidden inputs fields generated on the form page (if you are submitting the form to itself) and then just keep adding more hidden input elements to the form as you get more previously entered data to add.

What would the code look like for the hidden input field?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum