John is right, of course, I was only getting the value. I had it bass-acwards in the original post. Since the end-all answer is that the <select> only passes the value, I'll have to rethink my use of the control.
Thanks, John. -----Original Message----- From: John W. Holmes [mailto:[EMAIL PROTECTED]] Sent: Thursday, October 03, 2002 7:57 PM To: 'Hutchins, Richard'; [EMAIL PROTECTED] Subject: RE: [PHP-DB] Pulling apart select list elements > I have a <select multiple></select> object named list[] that is passing > its > selected contents to an array. That part works fine. I can use a for loop > to > grab all of the selected items. Where I'm stuck is that I want to get both > the value AND the text for any given <option> element and simply numbering > the items in the array 1-N based on the number of rows is not sufficient. > > Example: > > <select name="itemList[]" multiple> > <option value="101">PHP For Dummies</option> > <option value="102">PHP For Professionals</option> > <option value="103">PHP For Gurus</option> > </select> > > I want to be able to be able to get both the value property (101, 102, > ...) > AND the text between the <option></option> tags. Currently, I'm only > getting > the text between the <option></option> tags. Is there a PHP function that > allows me to get to both? No, you only get the value="" part. I think your confused, or this isn't the correct code, when you say your are getting what's between <option></option> then you're doing something different. Bottom line, you only get the value part. If you want two values passed, then use some hidden elements to relate the values. <input type="hidden" name="itemListtext[101]" value="PHP For Dummies"> would relate to your first element. So in PHP, you'd have $_POST['itemList'][0] == 101 and $_POST['itemListtext'][$_GET['itemList'][0]] == "PHP For Dummies" If you're using your database correctly, all you should need is the number, anyhow... ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php