<input type="checkbox" name="task[]" value"16">
<input type="checkbox" name="task[]" value"26">
<input type="checkbox" name="task[]" value"56">

$tasks = $_REQUEST['task'];

print_r($tasks);

but I only get an array that tells me if the checkbox's are on - I need the values???

please help

    that is not going to work, because your variable name is the same for each checkbox.

      I think I got it to work:

      <FORM...>
      <INPUT type="checkbox" name="sports[snow]">Snow</INPUT>
      <INPUT type="checkbox" name="sports[skate]">Skate</INPUT>
      <INPUT type="checkbox" name="sports[surf]">Surf</INPUT>
      </FORM>

      Submitting this would generate an array, $sports:
      [snow] => 'On'
      [surf] => 'On'

        I think you're on the right track... here's a test I tried:

        <html>
        <head>
        <title>test</title>
        </head>
        <body>
        <form method="get" action="<?=$PHP_SELF?>">
        <input type="checkbox" name="test[]" value="10" />10<br />
        <input type="checkbox" name="test[]" value="20" />20<br />
        <input type="checkbox" name="test[]" value="30" />30<br />
        <input type="submit" name="submit" value="Submit" />
        </form>
        <p>
        <?php
        if ($GET['submit']){
        print_r($
        GET);
        }
        ?>
        </p>
        </body>
        </html>

        Worked fine for me... $_GET['test'] was an array with all checked values.

        • Mahamoti
           
          
          <?
          $test = $_REQUEST['test'];
          foreach ($test as $key => $value) {
          print "$key = $value<br>";
          }
          ?>
          
          <form name=form method=post action=test.php>
          <input type=checkbox value=1 name="test[]">1<br>
          <input type=checkbox value=2 name="test[]">2<br>
          <input type=checkbox value=3 name="test[]">3<br>
          <input type=submit>
          </form>
          
            25 days later

            Using your initial example:

            <input type="checkbox" name="task[]" value="16">
            <input type="checkbox" name="task[]" value="26">
            <input type="checkbox" name="task[]" value="56">
            
            
            $tasks = $_REQUEST['task'];
            print_r($tasks); 
            

            Notice the equal sign between value and double quotes within the INPUT tag ;-)

              Write a Reply...