Reply to Re: New problem for Newbie

Your name:

Reply:


Posted by Michael Fesser on 06/16/07 13:38

..oO(william.clarke)

>If for some reason you want to
>concatenate the ID and Section
>together you can just go:
>
>echo "<option value=\"".$id.$section."\">".$section."</option>\n";
>
>NOTE: I have used double quotes which makes a few extra escape
>characters necessary, and I'm also using the . to concatenate the
>various parts of the string. This is just a personal preference thing
>and there are plenty of other valid ways you can achieve the same
>result.

The problem with that is that it pretty much defeats the purpose of
double-quoted strings and slows down the code a bit. And didn't I
already say that HTML also allows single-quoted attributes? Anyway.

(Just my 2 cents.)

Another problem with the code itself -- if the OP really wants that --
is the server-side validation before processing the form data. A simple
numeric ID is usually easier to validate against an array for example
than a complex string like in the code above. I still don't see any
point in using both $id and $section in the 'value' attributes.

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

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