Also check the archives for the php-db list. Questions very similar to this
get asked just about every week and you might be able to find more
information there.

Rich

-----Original Message-----
From: nikos [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, September 10, 2002 7:51 AM
To: PHP-mailist
Subject: Fw: [PHP-DB] php -> checkboxes -> mysql



> You should first check if checkbox value stored in the databese is 1 or 0.
> After use an if clause:
> if ($checkbox==1) {
>     echo "<input type=\"checkbox\" name=\"checkbox\" value=\"1\" checked>"
> }
> elseif ($checkbox==0) {
>     "<input type=\"checkbox\" name=\"checkbox\" value=\"0\">"
> }
>
> Nikos
> --------------------------------------------------------------------------
--
> -------------------------------------------
>
> ----- Original Message -----
> From: "Chris" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, September 10, 2002 12:03 AM
> Subject: [PHP-DB] php -> checkboxes -> mysql
>
>
> > Greetings,
> >
> > I am just starting with php and need some help/code example for
> > setting checkbox values from mysql. My setup is the following:
> >
> > The mysql database holds data and checkbox values in respective columes.
> > For example
> >
> > name address phone homeno workno pagerno
> > Chris xxxx 555-1212 1 0 0
> >
> > 1 = checkbox should be checked
> > 0 = checkbox should not be checked
> >
> > On the webpage side I would have name, address and phone number
textboxes,
> > and then 3 checkboxes for the "homeno", "workno" and "pagerno".
> >
> > When the page loads I would like to have the checkboxes be automatically
> > checked or left uncheck based on the mysql query to the db. I do not
want
> > to do any grouping or anything, just query mysql for the homeno value,
set
> > it, then check the workno value, set it, etc..
> >
> > Any help is GREATLY appreciated.
> > Chris
> >
> >
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
>


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

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

Reply via email to