Re: checkboxes and php
| From: | Ignatius Reilly | Date: | Thu, 08 May 2003 17:45:35 +0000 |
| Subject: | Re: checkboxes and php | ||
| References: | 1 2 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-19810@lists.php.net to get a copy of this message | ||
Checkboxes are not passed by the browser unless they are checked.
The value attribute is usually irrelevant.
Note:
another method is to use:
<input type=checkbox name="materialid[<? echo
$row["material_id"];?>]">
This will pass a sequential array $_POST['materialid'] to the PHP server,
which is usually easier to process.
HTH
Ignatius
____________________________________________
----- Original Message -----
From: "Harpreet" <harpreet@crispincorp.com>
To: <php-windows@lists.php.net>
Sent: Thursday, May 08, 2003 7:46 PM
Subject: [PHP-WIN] checkboxes and php
> 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
>
>