Re: help help help!!!!!!pls........
| From: | Alberto Serra | Date: | Sat, 06 Jul 2002 13:59:15 +0000 |
| Subject: | Re: help help help!!!!!!pls........ | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-105858@lists.php.net to get a copy of this message | ||
Balaji Ankem wrote:
I have multiple check boxes ...and I gave the single name to all check boxes..... If I post to my php script I am not getting all the values as an array.....I am getting only one value(last value).....Correct. Since they are all named in the same way, the last one kills them all.
If I give name as OptionList[] I am getting an error for selectAll option.I never came to think about it, but the [] thing may actually disturb jscript. I usually do it like this: HTML side -------- <tr> <td>
<input type="hidden" name="control[]" value="1">
<input type="checkbox" name="OptionList_1" value="x">
Option 2
</input>
</td>
<td>Hi</td>
</tr>
<tr>
<td>
<input type="hidden" name="control[]" value="2">
<input type="checkbox" name="OptionList_2" value="x">
Option 2
</input>
</td>
<td>Hi</td>
</tr>
PHP side
---------
# put the received input into an ordered structure
##################################################
$count = 0;
while ( isset($control[$count]) ) {
# Build variable names;
#######################
$w_OptionList = "OptionList_".$count;
# get actual form values
########################
$OptionList[$count] = $$OptionList;
$count++;} Javascript ---------- I never use selectAll. But you can easily walk the array down in the very same way. пока Альберто Киев -- @-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@ LoRd, CaN yOu HeAr Me, LiKe I'm HeArInG yOu? lOrD i'M sHiNiNg... YoU kNoW I AlMoSt LoSt My MiNd, BuT nOw I'm HoMe AnD fReE tHe TeSt, YeS iT iS ThE tEsT, yEs It Is tHe TeSt, YeS iT iS ThE tEsT, yEs It Is.......