Re: [PHP] passing checkbox info

2002-08-20 Thread Jaski

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 "\n";
>   {
>?>
>
>
>   echo "";
>echo "height='50'
>border='0'>";
>   echo "";
>echo $row[1];
>   echo "";
>echo $row[2];
>   echo "";
>echo $row[3];
>   echo "";
>echo $row[4];
>   echo "";
>echo $row[5];
>   echo "";
>echo $row[6];
>   echo "";
>echo $row[7];
>   echo "";
>echo $row[8];
>   echo "\n";
>   }
>
>  echo "\n";
>
>}
>
>echo "";
>
>?>
>
>
>
>--
>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




RE: [PHP] passing checkbox info

2002-08-20 Thread Martin Towell


replace "xxx" with the row number for your id field

when it gets to php, the index of $cbox will be the id from the database,
just use:
   foreach ($cbox as $id=>$dummy)
to loop through the array

HTH
Martin

-Original Message-
From: Brian & Shannon Windsor [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 21, 2002 2:00 PM
To: [EMAIL PROTECTED]
Subject: [PHP] passing checkbox info


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 "\n";
  {
?>


";
   echo "";
  echo "";
   echo $row[1];
  echo "";
   echo $row[2];
  echo "";
   echo $row[3];
  echo "";
   echo $row[4];
  echo "";
   echo $row[5];
  echo "";
   echo $row[6];
  echo "";
   echo $row[7];
  echo "";
   echo $row[8];
  echo "\n";
  }

 echo "\n";

}

echo "";

?>



-- 
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