RE: [PHP-DB] inserting dynamic drop down menu data into mysql

From: Date: Wed, 07 Jan 2004 15:17:37 +0000
Subject: RE: [PHP-DB] inserting dynamic drop down menu data into mysql
Groups: php.db 
Request: Send a blank email to php-db+get-32313@lists.php.net to get a copy of this message
On 07 January 2004 15:12, Duane Barnes contributed these pearls of wisdom: > I'm having a problem with a standard html form. I'm using a > php function to > populate a drop down menu on a standard form. I want the > contents of the > submitted form to insert into a mysql table. All of the > variables are inserted correctly except for the data from the > drop down > menu. For some > reason it will only insert the first word in the variable. > It cuts off > everything after the frist word. This sounds like an unquoted multi-word attribute problem. [snip] > function build_dropdown() { > $sql = "select category from categories ORDER BY category"; > $result = mysql_query($sql) or DIE(mysql_error()." - > ".mysql_errno()); > > while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { > extract($row); $output .= "<option > value=$category>$category</option>"; Yup, here it is -- quote the argument to the value= attribute, and everything should be hunky dorey. Cheers! Mike -- Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: m.ford@leedsmet.ac.uk Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211

« previous php.db (#32313) next »