Results 1 to 4 of 4

Thread: Multiple Submision Form

  1. #1
    Join Date
    Sep 2011
    Posts
    9
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Multiple Submision Form

    So i have a form in the file index.php

    Code:
    <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.

  2. #2
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    What are you considering the first submit, first ever, first that day, that session, from an IP address? How are you storing this information?
    Corrections to my coding/thoughts welcome.

  3. #3
    Join Date
    Sep 2011
    Posts
    9
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    for the session
    I have this now...

    Code:
    <?php
    
    session_start();
    
    if($_POST)
    {
         $_SESSION['display'] .= '<div>'.$_POST['name'].'</div>';
    	 echo $_SESSION['display'];
    }
    
    ?>
    
    <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>
    Which does everything i need it to except I want the div that is created to have a unique name so i can move them seperatly

  4. #4
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    PHP Code:
    <?php

    session_start
    ();

    if(
    $_POST)
    {
         
    $_SESSION['display'] .= '<div id="id' time() . '">'$_POST['name'].'</div>';
         echo 
    $_SESSION['display'];
    }

    ?>

    <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>
    Corrections to my coding/thoughts welcome.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •