Reply to Re: Result of checkbox selection into an SQL request

Your name:

Reply:


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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация