-
PHP & HTML Problem
Hello,
I have a html form in which there are some checkbox with values. You can click as many checkboxes as you like which beomes an array when submitted.
For eg: <input type="checkbox" name="cb[]" value="1">
<input type="checkbox" name="cb[]" value="2">
<input type="checkbox" name="cb[]" value="3">
Now the thing is that i have converted those checkboxes into a dropdown like following:
<select name="cb[]">
<option value="1">First</option>
<option value="2">Second</option>
<option value="3">Third</option></select>
In this dropdown i want to add a option named: "all". So which will mean that all the options are selected. I know its easy but here the problem starts. I cannot modify the php code becuase its zend encoded. So i have to use html or javascript only to get this done.
Can anyone tell me in what way should i place values in the dropdown "all" option so when the form is submitted the php file thinks that all the options have been checked out.
Thanks.
-
Re: PHP & HTML Problem
I would advise that you have a hidden field. When an item is select, it loads the value into the hidden field. If ALL is select, it loops through the items in the dropdown and appnds a new hidden field with the same anme for each one.
I posted a function here which creates hidden fields dynamically. A little modification and you should be able to apply it to your problem.
-
Re: PHP & HTML Problem
Hi,
Can i have a code for that ? I am weak in java scritping.
Thanks.