Hi,
Just started picking up on PHP (from asp)... Going well. Like php a lot... except for........ My code is below... if someone can please help me get ALL the data from the $POST["catlist"] I would appreciate it.
Firstly: To ensure all the contents of "catlist" are selected, chuck this into the top.
<SCRIPT LANGUAGE=JavaScript>
function selectAll(box) {
for(var i=0; i<box.length; i++) {
box.options[i].selected = true;
}
}
</SCRIPT>
Secondly: The form
<form action="this.php" method="post" name=form>
select multiple size="10" name="catlist'>
<option value="3">Painter</option>
<option value="1">Database Designers</option>
<option value="2">Volunteer</option>
</select>
<input type="submit" name="btnSubmit" value="Submit" onClick="selectAll(this.form.catlist);">
</form>
Thirdly: this.php to capture the list into an array like this:
$catarray[0]=3
$catarray[1]=1
$catarray[2]=2
Here is what I have tried: (using php5)
$catarray= ($_POST['catlist']);
$catarray= array($_POST['catlist']);
other variations.
The most confusing is that Count($_POST['catlist']);)=1
Please please help... sob... boo hooo... sob..
My brain hurts....
J-E