Re: Pb with checkbox
| From: | Jason Wong | Date: | Thu, 18 Apr 2002 09:31:56 +0000 |
| Subject: | Re: Pb with checkbox | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-93500@lists.php.net to get a copy of this message | ||
On Thursday 18 April 2002 17:19, Frédéric Mériot wrote:
> Hello,
> I've got a little pb with checkboxes. In my form I've got 5 checkboxes
> which have the same name "sel". When I submit the form and when I display
> the form variable "sel", it displays the last value only. I cannot catch
> all the value checked in the form.
>
> If I try this code with coldfusion or ASP it displays a coma delimited list
> of all the values I checked in the form.
>
> How to fix this pb with PHP?
>
> My code:
>
> <!--- the form --->
> <form action="catalog.php" method="post">
> <table border="0" cellspacing="0" cellpadding="0">
> <?for ($i=1;$i<=$nb;$i++){
> <tr>
> <td align="center"><input type="checkbox"
> name="sel"
Name your checkboxes like:
name="sel[]"
In your script you would have access to an array called $sel which contains
the values of your checkboxes.
--
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
/*
Life does not begin at the moment of conception or the moment of birth.
It begins when the kids leave home and the dog dies.
*/