#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2000
    Posts
    31
    Rep Power
    15
    Hi,

    I try to print the results from the checkbox but I don't know the code. Can you help? Thanks!
    This is my test project!
    <form action="test.php3" method="POST">
    <input type=="text" name="name" MAXLENGTH="60" SIZE="20">
    <input type="checkbox" name="checks[]" value="item1">item1
    <input type="checkbox" name="checks[]" value="item2">item2
    <input type="checkbox" name="checks[]" value="item3">item3<br>
    <input type="checkbox" name="checks[]" value="item4">item4
    <input type="checkbox" name="checks[]" value="item5">item5
    <input type="checkbox" name="checks[]" value="item">item6
    <P><input type="Submit" value="Submit">
    ---------------------------
    My test.php3
    <?
    Thank you $name;
    Your selection is: ????
    ?>

    [This message has been edited by dalida (edited April 27, 2000).]
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 1999
    Location
    Annapolis, Maryland US
    Posts
    113
    Rep Power
    15
    <?
    $values=$HTTP_POST_VARS[checks];

    if(count($values)>0))
    {
    print"Thank you $name<br>";
    print"Your selection is ";
    print"<UL>";
    for($i=0; $i<count($values); $i++)
    print"<li>$values[$i]</li>";
    print"</UL>";
    }

    else
    print"You picked absolutely nothing!";
    }

    // format to taste

    Hip Hip Array

    Kyuzo
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2000
    Posts
    31
    Rep Power
    15
    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by Kyuzo:
    <?
    $values=$HTTP_POST_VARS[checks];

    if(count($values)>0))
    {
    print"Thank you $name<br>";
    print"Your selection is ";
    print"<UL>";
    for($i=0; $i<count($values); $i++)
    print"<li>$values[$i]</li>";
    print"</UL>";
    }

    else
    print"You picked absolutely nothing!";
    }

    // format to taste

    Hip Hip Array

    Kyuzo
    [/quote]

    -------
    Hello Kyuzo,
    I get a parse error on line 5
    Thanks !
  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2000
    Posts
    7
    Rep Power
    0
    <form action="test-response.php" method="POST">
    <input type=="text" name="name" MAXLENGTH="60" SIZE="20">
    <br><input type="checkbox" name="checks[]" value="item1">item One
    <br><input type="checkbox" name="checks[]" value="item2">item Two
    <br><input type="checkbox" name="checks[]" value="item3">item Three
    <br><input type="checkbox" name="checks[]" value="item4">item Four
    <br><input type="checkbox" name="checks[]" value="item5">item Five
    <br><input type="checkbox" name="checks[]" value="item6">item Six
    <P><input type="Submit" value="Submit">
    </form>


    test-response.php
    <?
    echo "Thank you $name<br>";
    if (sizeof($name) > 0) {
    echo "<br>Your selection is: ".implode(",",$checks);
    }
    ?>

    ------------------
    Cheers,
    Tata
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2000
    Posts
    31
    Rep Power
    15
    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by weddeh:
    <form action="test-response.php" method="POST">
    <input type=="text" name="name" MAXLENGTH="60" SIZE="20">
    <br><input type="checkbox" name="checks[]" value="item1">item One
    <br><input type="checkbox" name="checks[]" value="item2">item Two
    <br><input type="checkbox" name="checks[]" value="item3">item Three
    <br><input type="checkbox" name="checks[]" value="item4">item Four
    <br><input type="checkbox" name="checks[]" value="item5">item Five
    <br><input type="checkbox" name="checks[]" value="item6">item Six
    <P><input type="Submit" value="Submit">
    </form>


    test-response.php
    <?
    echo "Thank you $name<br>";
    if (sizeof($name) > 0) {
    echo "<br>Your selection is: ".implode(",",$checks);
    }
    ?>
    [/quote]

    Cool! it work fine... thanks a lot for your help.

    Regards!
    Dalida

Similar Threads

  1. permissions after uploading
    By Paul Niessen in forum Perl Programming
    Replies: 3
    Last Post: February 15th, 2004, 05:51 PM
  2. Help with HTML Parsing
    By musashiBRS in forum Python Programming
    Replies: 6
    Last Post: February 13th, 2004, 02:32 AM
  3. Writing to two *.csv files
    By CAR in forum Perl Programming
    Replies: 4
    Last Post: February 7th, 2004, 04:39 PM
  4. need help with testing non-alphanumeric input
    By pinkipodmini in forum PHP Development
    Replies: 1
    Last Post: January 23rd, 2004, 01:48 PM
  5. howto get NICK_NAME and print results?
    By marnixvandalen in forum Perl Programming
    Replies: 0
    Last Post: January 5th, 2004, 01:35 AM

IMN logo majestic logo threadwatch logo seochat tools logo