RE: [PHP-WIN] Re: php and checkboxes
| From: | Matt Babineau | Date: | Thu, 08 May 2003 19:23:02 +0000 |
| Subject: | RE: [PHP-WIN] Re: php and checkboxes | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-19814@lists.php.net to get a copy of this message | ||
I think I may have a real simple yet elegant solution:
<Input type="hidden" name="your_checkbox" value="0">
<Input type="checkbox" name="your_checkbox" value="1">
So what happens is if the checkbox isn't checked, when submitted
your_checkbox will equal 0. And if it is checked your_checkbox will equal 1.
Matt Babineau
www.criticalcode.com
e:: matt@criticalcode.com p:: 603.943.4237
| -----Original Message-----
| From: Iggy [mailto:ifran@winegard.com]
| Sent: Thursday, May 08, 2003 3:15 PM
| To: php-windows@lists.php.net
| Subject: [PHP-WIN] Re: php and checkboxes
|
|
| I did this:
|
| $y = "yes";
| if(!isset($_POST["Y"]))
| $y = "no";
|
|
| where "Y" was the name of the checkbox.
|
|
|
| "Harpreet" <harpreet@crispincorp.com> wrote in message
news:015f01c3158c$0aa8df70$6001a8c0@harpreet...
> I have checkboxs in a form for deletion
>
> <input type=checkbox name="materialid<? echo
> $row["material_id"];?>">
> The above code create a checkbox for each row in the table.
>
> I would like to delete multiple records using the above.
>
> if i check 3 checkboxes for deletion and use
>
> matid1=$HTTP_POST_VARS["materialid$matid"]; to find out if the
> checkbox is checked. It works for the checkboxes that are checked but
> gives me an
error
> for the unchecked checkboxes.
>
> Erro message:
> Notice: Undefined index: materialid1020 in
> e:\..scripts\asset_delete2.php
on
> line 17
>
> Notice: Undefined index: materialid1030 in
> e:\..scripts\asset_delete2.php
on
> line 17
> and so on.
>
> How can i skip the ones i dont check at all or skip the error message
> frm showing. I dont care about the ones i dont check in the previous
> form.
>
> Thanks,
>
>
>
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php