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
Navigation:
[Reply to this message]
|