Re: Re: Dynamically populating a dropdown box
| From: | Paul DuBois | Date: | Sat, 15 Dec 2001 03:13:19 +0000 |
| Subject: | Re: Re: Dynamically populating a dropdown box | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-15052@lists.php.net to get a copy of this message | ||
At 10:46 -0800 12/14/01, Richard S. Crawford wrote:
At the risk of sounding like a browser-snob... The quotes probably don't matter in IE, but that's primarily IE allows (and, in my opinion, encourages) bad coding practices. Your "echo" command really ought to look like this: echo "<option value=\"" . $row["ID"] . "\" $selected>" . $row["name"] . "</option>\n"; Many coders even forget to put in the closing tag: </option>. That would work in IE, and probably even in Netscape, but it's bad coding practice.And the ID and name values should be encoded with htmlspecialchars() in case they contain double quotes or something else special...
Strive to keep your code as compliant with XHTML1.1 standards as possible. When you make the switch to XML, you will find your task much easier. "Weird-ass browsers" indeed. Hmph. At 10:41 AM 12/14/2001, you wrote:the value can be in single quotes also, altho i dont think quotes matter unless you use opera or some other wierdass browser (you can also put doubles using \")Sliante, Richard S. Crawford http://www.mossroot.com AIM: Buffalo2K ICQ: 11646404 Y!: rscrawford MSN: underpope@hotmail.com