FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » populate pulldownbox from query
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: populate pulldownbox from query [message #174105 is a reply to message #174061] Sat, 21 May 2011 21:19 Go to previous messageGo to previous message
Thomas 'PointedEars'  is currently offline  Thomas 'PointedEars'
Messages: 701
Registered: October 2010
Karma:
Senior Member
Jeff North wrote:

[attribution novel trimmed, quotation fixed; see <http://learn.to/quote>]

> Denis McMahon wrote:
>> General observation, html attributes, such as the select name, option
>> values etc should be enclosed in quotes at the html level, such as one
>> of the following:
>>
>> echo "<option value='$some_var_name'>some text</value>";
>> echo "<option value=\"$some_var_name\">some text</value>";
>> echo '<option value="$some_var_name">some text</value>';

The third one is not equivalent to the former two; the outer single quotes
prevent variable expansion. It would have to be

echo '<option value="' . $some_var_name . '">some text</value>';

Another possibility are HereDoc strings:

echo <<<HTML
<option value="{$some_var_name}">some text</value>
HTML;

Do not forget htmlspecialchars($some_var_name) in any case!

> Not to quibble about such a matter but you don't necessarily need
> quotes around attributes (I prefer quotes as any syntax highlighting
> editor will show the values up).
>
> http://www.w3.org/TR/html4/intro/sgmltut.html#h-3.2.2
> In certain cases, authors may specify the value of an attribute
> without any quotation marks. The attribute value may only contain
> letters (a-z and A-Z), digits (0-9), hyphens (ASCII decimal 45),
> periods (ASCII decimal 46), underscores (ASCII decimal 95), and colons
> (ASCII decimal 58). We recommend using quotation marks even when it is
> possible to eliminate them.

Mark the last sentence which is essentially what Denis said, and consider
that XML-based document types *require* the quotes (for well-formedness).


PointedEars
--
var bugRiddenCrashPronePieceOfJunk = (
navigator.userAgent.indexOf('MSIE 5') != -1
&& navigator.userAgent.indexOf('Mac') != -1
) // Plone, register_function.js:16
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: he
Next Topic: Detecting Redirected Output
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Nov 24 00:52:15 GMT 2024

Total time taken to generate the page: 0.03835 seconds