|
Posted by Michael Fesser on 06/14/07 21:09
..oO(ZeldorBlat)
>And, BTW, you technically need (read: you should) have double quotes
>around $id. So something like this:
>
>echo "<option value=\"$id\">$section\r\n";
Some notes:
* Single quotes are fine as well and avoid the ugly escaping.
* For better code all elements should be closed, even if some end tags
are optional in HTML.
* A simple \n line ending is enough.
* It's usually a good idea to use htmlspecialchars() when printing HTML
to avoid validator warnings because of literal '&' or '<' chars.
So it should be at least
echo "<option value='$id'>$section</option>\n";
or better
printf("<option value='%u'>%s</option>\n",
$id,
htmlspecialchars($section)
);
For the OP:
* The form's 'action' attribute should not contain an empty URL ('#' is
an empty URL with an empty fragmet identifier), as some older browser
get it wrong.
* Attribute values should always be quoted (single- or double-quotes).
Micha
[Back to original message]
|