|
Posted by william.clarke on 06/17/07 00:35
On Jun 16, 11:38 pm, Michael Fesser <neti...@gmx.de> wrote:
> .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
Hi Micha,
I totally agree with you, as far as I can see ID is all the OP needs
in the value attribute of the list item, but he keeps asking about
including $SECTION so I have given him an example of what I
interpreted to be current question (I'm not suggesting that I can see
any obvious reason for it).
With regard to the quotes, as I usually aim for 100% standards-
compliant XHTML I'll stick with double quoting attributes (as per the
XHTML spec examples: http://www.w3.org/TR/xhtml1/#h-4.4 ) even
though it does not explicitly say which quotation marks are valid I'll
just follow the W3C example for now.
William
[Back to original message]
|