Posted by Erwin Moller on 09/13/05 13:15
Nicolas Rubin wrote:
> Hi,
>
> I would transfer the result of a checkbox selection into an SQL request.
>
> Could you help me ?
>
> Many thanks in advance
>
> Nicolas
Hi
If you expect a checkbox named 'clientwantsspam', try this in the receiving
script:
$clientwantsspam = "N";
if (isset($_POST["clientwantsspam"])){
$clientwantsspam = "Y";
}
or any other variation that suits your needs.
eg: if you want the VALUE of the checkbox:
$clientwantsspam = "notavailable";
if (isset($_POST["clientwantsspam"])){
$clientwantsspam = $_POST["clientwantsspam"];
}
The point/problem is that the checkbox is only send when checked, so your
receiving script must test if it exists.
Of course you can also use shorthandnotation:
$clientwantsspam = ((isset($_POST["clientwantsspam"]) ?
$_POST["clientwantsspam"]: "NotAvailable");
which probably wrapped in your newsreader. ;-)
Good luck.
Regards,
Erwin Moller
[Back to original message]
|