Re: Help needed with multiple select form element and PHP !

From: Date: Wed, 02 May 2001 23:26:12 +0000
Subject: Re: Help needed with multiple select form element and PHP !
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-51139@lists.php.net to get a copy of this message
try this, <form name="f1"> <select name="selectall[]"> <option>line1</option> <option selected>line2</option> <option>line3</option> </select> <input type="text" name="txt1"> </form> <script language="JavaScript"> <!-- selectobjname = "selectall[]"; selectobj = null; for (i=0; i< f1.elements.length; i++) { if (f1.elements[i].name == selectobjname) { alert('found element, and got a pointer of it'); selectobj = f1.elements[i]; } else alert(f1.elements[i].name); } alert('currently selected item:' + selectobj.options[selectobj.selectedIndex].text); //--> </script> should help you out! -elias http://eassoft.cjb.net ""Nicolas Guilhot"" <nguilhot@gphy.campus.univ-poitiers.fr> wrote in message news:NEBBLNMCKLOGFKNONHDAEEPACBAA.nguilhot@gphy.campus.univ-poitiers.fr... > Hi, > > I've got a select tag with multiple selection enabled. When the user submit > the form, I want to pass all options from the select to another page. For > this I use javascript to select every element in my select tag. My problem, > is that in PHP, to access all selected elements in an array, I need to give > my select tag a name like 'myselect[]'. If I use this naming, I can't use my > Javascript code to select every element before submitting the form. > > How can I get both thing to work : my javascript code to select every > element, and my php code to access every element ?? > > Thanks for any answer. > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#51139) next »