Re: Check Boxes

From: Surojit Niyogi <surojit(at)bungeecode(dot)com>
To: "Julio Cuz, Jr(dot)" <jcuz(at)rccd(dot)cc(dot)ca(dot)us>
Cc: php-db(at)lists(dot)php(dot)net, pgsql-php(at)postgresql(dot)org
Subject: Re: Check Boxes
Date: 2002-04-29 15:58:39
Message-ID: 3CCD6DAF.6060005@bungeecode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-php

Julio,

The way I see it checkboxes are just boolean graphical representations.
Either a "yes" or "no" value if the box is checked or not,
respectively. Hence, it would make sense for the field to be of type
"bool". As far as storing goes, PHP sees a checked box of having a
value of "on" and an unchecked box of having a value of false (or
empty). So what I typically do is have a function called is_checked()
that passes the form field.

function is_checked($form_field){
global $HTTP_POST_VARS;
if($HTTP_POST_VARS[$form_field[ == "on")
return 1;
else
return 0;
}

In my SQL statement I pass the returned value directly

$strSQL = "INSERT INTO blah (is_foo) VALUES (" . is_checked('is_foo') . ")"

Hope this helps. :D

-Roj Niyogi
Founder
pgHoster
PostgreSQL web hosting

http://www.pghoster.com

Julio Cuz, Jr. wrote:

> Hi--
>
> Does anyone have any suggestions, SAMPLES, or ideas on how to STORE,
> RETRIEVE, AND PROCESS values for "Check Boxes" w/PHP & Postgresql?
>
> Thanks!
>
> Julio Cuz, Jr.
> Riverside Community College
> jcuz(at)rccd(dot)cc(dot)ca(dot)us
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)
>
>

In response to

  • Check Boxes at 2002-04-29 15:32:58 from Julio Cuz, Jr.

Browse pgsql-php by date

  From Date Subject
Next Message frederic massot 2002-04-30 12:51:55 Pb with the French accentuated characters
Previous Message Eckhard Hoeffner 2002-04-29 15:52:15 Re: Check Boxes