RE: [PHP-DB] Capturing select values from a multliple-select list box

From: Date: Tue, 23 Oct 2001 01:39:31 +0000
Subject: RE: [PHP-DB] Capturing select values from a multliple-select list box
Groups: php.db 
Request: Send a blank email to php-db+get-13618@lists.php.net to get a copy of this message
i *think* you can do something like <select name="county[]"> and then it will pass an array on submission (someone please correct if wrong!) failing that, you could use a javascript:onChange() function to set the value of a hidden field using something like (snippet from previous project) function updateValueString() { var newValueString = ""; for ( i = 0; i < document.query.include_list.length; i++ ) { newValueString += "|" + document.query.include_list[i].value; } document.query.include.value = newValueString; } then on the next page, ignore the value submitted from the actual select, and just work with the value submitted by the hidden field. HTH /beau // -----Original Message----- // From: kimbjork@infoaxis.com [mailto:kimbjork@infoaxis.com] // Sent: Tuesday, 23 October 2001 1:46 AM // To: php-db@lists.php.net // Subject: [PHP-DB] Capturing select values from a // multliple-select list // box // // // I have this bit of code where I am presenting the user a // mulitiple-select // dropdown box in a form as shown below: // // <select NAME="county" SIZE=5 MULTIPLE> // <?php // // get county list // $query = "SELECT cid, county FROM allcounties"; // $result = mysql_query($query, $connection) or die ("Error // in query: // $query. " . mysql_error()); // while (list($cid, $county) = mysql_fetch_array($result)) // { // echo "<option value=$cid>$county</option>"; // } // ?> // </select> // // My newbie question is, "How can I capture the values // associated with the // users' selections from the 'county' box?" Besides wanting // to save these // values to another table, I would like to do other things with the // selections prior to completing the processing of this form. // // Thanks, // // Kim Bjork // www.infoaxis.com // // // -- // PHP Database Mailing List (http://www.php.net/) // To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net // For additional commands, e-mail: php-db-help@lists.php.net // To contact the list administrators, e-mail: // php-list-admin@lists.php.net //

« previous php.db (#13618) next »