Reply to Re: New problem for Newbie

Your name:

Reply:


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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация