j-e 0 Newbie Poster

Sideline comment No big deal.. it did break the "selectALL()" javascript (see point 1 of original post). But that should be a minor issue to fix.

j-e 0 Newbie Poster

Thanks a million. I appreciate your time. The solution makes perfect sense. Makes me wanna take up line dancing (sometimes).

Cheers

J-E

j-e 0 Newbie Poster

Thanks for that... Unfortunately it seems there is no array coming through the POST. Only one value instead of 3.... any suggestions on how to get around it?

I will play around further.

J-E

j-e 0 Newbie Poster

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