How to display form submission details on the webpage?

Discussion in 'Programming' started by HaroonB, Dec 19, 2009.

  1. #1
    hello, how can put a form on my website which when you submit the info displays the results on the webpage as a list, for example if i submitted, blue, green and yellow in my form it would show up as:

    Blue
    Green
    Yellow

    and how can i make categories for that, like if i submitted 1, 2 and 3 aswell it would show:

    Colours
    Blue
    Green
    Yellow

    Numbers
    1
    2
    3

    Thanks
     
    HaroonB, Dec 19, 2009 IP
  2. shall

    shall Member

    Messages:
    111
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    28
    #2
    What do you use ASP, PHP, something else ?
     
    shall, Dec 19, 2009 IP
  3. HaroonB

    HaroonB Peon

    Messages:
    23
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    im using php
     
    HaroonB, Dec 19, 2009 IP
  4. shall

    shall Member

    Messages:
    111
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    28
    #4
    if you have something like this

    <form action="details.php" method="post">
    Detail1: <input type="text" name="detail1" />
    Detail2: <input type="text" name="detail2" />
    <input type="submit" />
    </form> 
    HTML:
    details.php:
    Detail1: <?php echo $_POST["detail1"]; ?><br />
    Detail2: <?php echo $_POST["detail2"]; ?>
    Code (markup):
    Hope this helps :) If you have additional questions please ask :D
     
    shall, Dec 19, 2009 IP
  5. HaroonB

    HaroonB Peon

    Messages:
    23
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    works great thanks just what i was looking for
     
    HaroonB, Dec 19, 2009 IP
  6. shall

    shall Member

    Messages:
    111
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    28
    #6
    no problem :D
     
    shall, Dec 19, 2009 IP
  7. HaroonB

    HaroonB Peon

    Messages:
    23
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    oh and 1 more question is there any way i can numerically put them in order?
     
    HaroonB, Dec 20, 2009 IP
  8. shall

    shall Member

    Messages:
    111
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    28
    #8
    <?php
    $count = 1;
    foreach (array_keys($_POST) as $key) {
    $$key = $_POST[$key];
    print "$count - $key is ${$key}<br />";
    count++;
    }
    ?> 
    Code (markup):
    try this, I don't know if this will work, I haven't tried it out. :confused:
     
    shall, Dec 20, 2009 IP