Hi,
First PHP project here.
I have a list of fields for a sql query, and I want the user to be able to pick any number of them. I want an "All" button next to it that will select all the elements of this list box. So I wrote this little JavaScript function.
function selectAll(object) {
for (i = 0 ; i < object.length ; i++) {
object.options.selected = true;
}
}
Then if list is the name of your listbox,
<input name="all" type="button" onClick="selectAll(this.form.list)">
should do the trick.
The trouble is...to make PHP recognize the listbox as taking array values, it needs to be
<select name="list[]">...</select>. But JavaScript complains about the brackets.
Surely somebody has come across this before?
Thanks for any help.
--Matt