Re: checkbox
| From: | abrea | Date: | Wed, 30 Jun 2004 15:59:43 +0000 |
| Subject: | Re: checkbox | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-189302@lists.php.net to get a copy of this message | ||
If you put square brackets after the name (e.g. var[]) your form should
produce an array called $_POST["var"] that comprises the checked boxes
only.
e.g.
<form method="post" ...>
<input type="checkbox" name="var[]" value="value1">
<input type="checkbox" name="var[]" value="value2">
<input type="checkbox" name="var[]" value="value3">
Regards
Alberto Brea
estudio_brea@yahoo.com
-----Original Message-----
From: "Aris Santillan" <aris.santillan@summitmedia.com.ph>
To: <php-general@lists.php.net>
Date: Wed, 30 Jun 2004 15:56:35 +0800
Subject: [PHP] checkbox
> how can process only items with checked check-box?
>
> ----------- html -------------------
>
>
>
> <html>
> <head>
> <title>Untitled Document</title>
> </head>
>
> <body>
> <form name="form1" method="post" action="">
> <p>
> <input type="checkbox" name="checkbox"
> value="checkbox">
> <input type="text" name="textfield[1]">
> </p>
> <p>
> <input type="checkbox" name="checkbox"
> value="checkbox">
> <input type="text" name="textfield[2]">
> </p>
> <p>
> <input type="checkbox" name="checkbox"
> value="checkbox">
> <input type="text" name="textfield[3]">
> </p>
> <p>
> <input type="checkbox" name="checkbox"
> value="checkbox">
> <input type="text" name="textfield[4]">
> </p>
> <p>
> <input type="checkbox" name="checkbox"
> value="checkbox">
> <input type="text" name="textfield[5]">
> </p>
> </form>
> </body>
> </html>
>
>
>
> ----------- html -------------------
>
>
>
>
>
>
>
>