Re: cant store checkbox vale ..... ?????

2002-07-29 Thread Merlin, The Mage

On Tuesday 30 July 2002 07:13 am, toby - wrote:
> (...)
> sign me up fo weekly news
> letter and updates
> (...)
> the processing  for this is:
>
> $isql = "insert into usr_inf (email, firstName, lastName, news_letter_subs)
> " .
> "values ('" . $email . "', '" . $firstName . "', '" . $lastName . "','" .
> $news_letter_subs ." ') ";
> (...)

Hi Toby,

Two points:
First, I presume you're quotting ($dbh->quote(...)) your data between 
the 
cgi retrieve and that your insert. if you aren't, you should.

Second... well it depends on the browser you're using on your testes. 
Some 
browser with check boxes like yours (with no value) send only the field with 
no value (an http parameter like this ...&news_letter_subs=&...) and other 
send an ON value on checked checkbox fields with no value (an http parameter 
like this ...&news_letter_subs=ON&...) - In this last ones your wuery should 
work at all if as i presume your field is numeric.

I presume that your field is a numeric, so mysql uses the '' value as a 0. 
What you must do is one of two things. Depending on the way you parse/the 
module you use to parse your query string, you must check if your parameter 
news_letter_subs is defined. And if it is defined your checkbox was checked, 
since unchecked checkbox fields are not sent. 

Or, the simplest way, just change your HTML to this

sign me up fo weekly news 
letter and updates

And this way, the value you get if the field is checked is allways 1.

MPNeves
-- 
Merlin, the Mage
themage.camelot.co.pt

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: cant store checkbox vale ..... ?????

2002-07-29 Thread Shashank Tripathi

Toby,

This is not a MySQL question, it is an issue of PHP and would be best asked
on a PHP forum. But in any case, the "value" tag is missing in your checkbox
HTML.

Shashank


sql,query


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




cant store checkbox vale ..... ?????

2002-07-29 Thread toby -



hi guys

im stuck with check boxes now

n id b really gratefull if anyone d help plx 

the thing is i cnt get the cheked value from a checkbox


sign me up fo weekly news letter 
and updates



the processing  for this is:

$isql = "insert into usr_inf (email, firstName, lastName, news_letter_subs) 
" .

"values ('" . $email . "', '" . $firstName . "', '" . $lastName . "','" . 
$news_letter_subs ." ') ";




after a million checks on the passed data all the fileds get stored in my db

except fo news_letter_subs

i get a 0 fo it in my db :S



where m i mucking it up

guyz plz hlp 

thnx a million

toby .

_
MSN Photos is the easiest way to share and print your photos: 
http://photos.msn.com/support/worldwide.aspx


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php