RE: inserting dynamic drop down menu data into mysql

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx
Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux