Display Multiple Inputs from one Input field

So i have a form in the file index.php

[CODE]

[/CODE]

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.

Hi there,

Try this snippet of code and see if it does what you want it to do:

[php]<?php

session_start();

if($_POST)
{
$_SESSION[‘display’] .= $_POST[‘name’].’
’;
echo $_SESSION[‘display’];
}

?>

[/php]

What my code is doing is appending the value received from the form and including a break tag to separate the values by line. This code should work for you so long as you don’t change the page or close the page.

Hope this helps.

Thanks,

That almost perfect for what i need to do. I forgot to mention i want to display every result in its own div.

Hi again,

Just change one line of the code to show the following:

[php]$_SESSION[‘display’] .= ‘

’.$_POST[‘name’].’
’;[/php]

Hope that helps.

Your amazing thanks so much!

This does everything i need it to except I want the div that is created to have a unique name so i can move them separately, any suggestions?

You have to use div ids to saperate the div

Suppose

and other one

Hope you will find this helpful

Sponsor our Newsletter | Privacy Policy | Terms of Service