echo ('<option value="' . $row["ID"] . '">' . $row["Category"] .
'</option>');
You might be able to escape the " with /" or the like but I'm not great at
php, yet. ;)
----- Original Message -----
From: "Neil Silvester" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, September 19, 2001 5:42 PM
Subject: PHP and Mysql problem
> I am having a little problem with a PHP 4 statement in one of my webpages.
I
> am using a drop down box of selections that is built a table in a MySQL
> database.
> This is what I have so far (everything works well, the correct information
> is displayed for both the Category and ID column values.
>
> <select name="Product">
> <option>Please select a category...</option>
> <?php
> // display entries in the selection box and
> // associate the column ID of each entry
> while ($row = mysql_fetch_array($result)) {
> echo("<option value=" . $row["ID"] . ">" . $row["Category"] .
"</option>");
> }
> ?>
> </select>
>
>
> Unfortunately this causes the HTML code to b
> <OPTION value=1>Product Category 1</OPTION>
> when I need it to be
> <OPTION value="1">Product Category 1</OPTION>
>
> Can anyone recommend another approach so that the quotation marks are
> generated around the ID value that is returned?
> TIA
>
>
>
> _________________________________________________________________
> Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
>
>
> ---------------------------------------------------------------------
> Before posting, please check:
> http://www.mysql.com/manual.php (the manual)
> http://lists.mysql.com/ (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail
<[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php