pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Check Boxes
3+ messages / 3 participants
[nested] [flat]

* Check Boxes
@ 2002-04-29 15:32 Julio Cuz, Jr. <jcuz@rccd.cc.ca.us>
  2002-04-29 15:52 ` Re: Check Boxes Eckhard Hoeffner <e-hoeffner@fifoost.org>
  2002-04-29 15:58 ` Re: Check Boxes Surojit Niyogi <surojit@bungeecode.com>
  0 siblings, 2 replies; 3+ messages in thread

From: Julio Cuz, Jr. @ 2002-04-29 15:32 UTC (permalink / raw)
  To: php-db@lists.php.net; pgsql-php

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@rccd.cc.ca.us




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Check Boxes
  2002-04-29 15:32 Check Boxes Julio Cuz, Jr. <jcuz@rccd.cc.ca.us>
@ 2002-04-29 15:52 ` Eckhard Hoeffner <e-hoeffner@fifoost.org>
  1 sibling, 0 replies; 3+ messages in thread

From: Eckhard Hoeffner @ 2002-04-29 15:52 UTC (permalink / raw)
  To: pgsql-php

* Julio Cuz, Jr. <jcuz@rccd.cc.ca.us> [29 04 02 17:32]:

>Hi--
>
>Does anyone have any suggestions, SAMPLES, or ideas on how to STORE, 
>RETRIEVE, AND PROCESS values for "Check Boxes" w/PHP & Postgresql?

1.
Use an arry within the HTML-Tags: 

	name="checkbox" value="data[0]"
	name="checkbox" value="data[1]"

2. 
To process with PHP just a simple loop
	
	foreach($array as $var => $value)


-- 
--//--\\--
Eckhard Hoeffner
e-hoeffner@fifoost.org
Tal 44 
D-80331 München



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Check Boxes
  2002-04-29 15:32 Check Boxes Julio Cuz, Jr. <jcuz@rccd.cc.ca.us>
@ 2002-04-29 15:58 ` Surojit Niyogi <surojit@bungeecode.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Surojit Niyogi @ 2002-04-29 15:58 UTC (permalink / raw)
  To: Julio Cuz, Jr. <jcuz@rccd.cc.ca.us>; +Cc: php-db@lists.php.net; 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@rccd.cc.ca.us
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>    (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>
>





^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2002-04-29 15:58 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-04-29 15:32 Check Boxes Julio Cuz, Jr. <jcuz@rccd.cc.ca.us>
2002-04-29 15:52 ` Eckhard Hoeffner <e-hoeffner@fifoost.org>
2002-04-29 15:58 ` Surojit Niyogi <surojit@bungeecode.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox