1)Name value pairs of check boxes which are checked will be 
returned.
2)To figure out which check box is returning "yes" you can use the 
keys of the cbox[] array which is returned. That is if your query 
returns 10 rows .. and user checks checkbox 1,3 and 5 out of those 
.. then $cbox[0], $cbox[2],$cbox[4] .. will have values "yes".

3)Then you can use $checked = array_keys($cbox) .. and $checked 
will be an array having all the keys of returned cbox array. ie 
(0,2,4) in the above case.

HTH
Jaski

On Wed, 21 Aug 2002 Brian & Shannon Windsor wrote :
>I'm trying to use checkboxes to be able to delete information 
> from my
>database.  It's just not working right.  I can't get the checkbox 
>form to
>pass a variable that makes any sense to me, and I looked into the 
>check box
>function, and it made less sense.  The value passed back from the 
>check
>boxes are always "yes", but there is nothing to tell which box 
>passed it
>back.  Maybe I don't know enough about the check boxes in 
>general.  Any help
>is appreciated.
>
>I'm displaying the checkboxes as I display the data from the 
>database. Can I
>tie in the checkboxes to one of the fields that i could then use 
>to delete
>that entry?
>
>Thanks,
>
>Brian
>
>while ($row = mysql_fetch_row($result))
>{
>  echo "<tr align=left>\n";
>   {
>?>
><td>
><input type = "checkbox" name = "cbox[]" value = "yes">
><?php
>   echo "<td>";
>    echo "<a href='$row[0]'><img src='$row[0]' width='80' 
>height='50'
>border='0'>";
>   echo "<td>";
>    echo $row[1];
>   echo "<td>";
>    echo $row[2];
>   echo "<td>";
>    echo $row[3];
>   echo "<td>";
>    echo $row[4];
>   echo "<td>";
>    echo $row[5];
>   echo "<td>";
>    echo $row[6];
>   echo "<td>";
>    echo $row[7];
>   echo "<td>";
>    echo $row[8];
>   echo "</td>\n";
>   }
>
>  echo "</tr>\n";
>
>}
>
>echo "</table>";
>
>?>
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to