Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Sep 2011
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Display Multiple Inputs from one Input field

    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
    Senior Coder Rowsdower!'s Avatar
    Join Date
    Oct 2008
    Location
    Some say it's everything.
    Posts
    2,027
    Thanks
    5
    Thanked 397 Times in 390 Posts
    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.
    The object of opening the mind, as of opening the mouth, is to shut it again on something solid. –G.K. Chesterton
    See Mediocrity in its Infancy
    It's usually a good idea to start out with this at the VERY TOP of your CSS: * {border:0;margin:0;padding:0;}
    Seek and you shall find... basically:
    validate your markup | view your page cross-browser/cross-platform | free web tutorials | free hosting

  • #3
    New to the CF scene
    Join Date
    Sep 2011
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Rowsdower! View Post
    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?


  •  

    Posting Permissions

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