Display Multiple Inputs from one Input field

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
deadman6
Forum Newbie
Posts: 4
Joined: Wed Sep 14, 2011 1:51 pm

Display Multiple Inputs from one Input field

Post by deadman6 »

So i have a form in the file index.php

Code: Select all

<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.
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: Display Multiple Inputs from one Input field

Post by social_experiment »

I think 'old' $_POST data is cleared the moment that you submit the form again so another method of storing the previously entered data is required, perhaps a cookie or session variable
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
Post Reply