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