Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #1753

Re: populate pulldownbox from query

Message-Id <8792709.pXjbOYK8lx@PointedEars.de>
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Organization PointedEars Software (PES)
Date 2011-05-21 23:19 +0200
Subject Re: populate pulldownbox from query
Newsgroups comp.lang.php
References <7e34dca3-a1f3-4bdf-acbd-8288e6a30581@gu8g2000vbb.googlegroups.com> <4dd6c9cd$0$30688$bed64819@gradwell.net> <dipdt6htdougvbgfj5pfribnhgc1cg68n3@4ax.com>
Followup-To comp.lang.php

Followups directed to: comp.lang.php

Show all headers | View raw


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

Back to comp.lang.php | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

populate pulldownbox from query Co <vonclausowitz@gmail.com> - 2011-05-20 11:30 -0700
  Re: populate pulldownbox from query Luuk <Luuk@invalid.lan> - 2011-05-20 20:40 +0200
  Re: populate pulldownbox from query Jerry Stuckle <jstucklex@attglobal.net> - 2011-05-20 15:13 -0400
    Re: populate pulldownbox from query Denis McMahon <denis.m.f.mcmahon@gmail.com> - 2011-05-20 20:19 +0000
      Re: populate pulldownbox from query Michael Fesser <netizen@gmx.de> - 2011-05-20 22:41 +0200
        Re: populate pulldownbox from query Chuck Anderson <cycletourist@invalid.invalid> - 2011-05-20 16:44 -0600
          Re: populate pulldownbox from query Co <vonclausowitz@gmail.com> - 2011-05-20 15:56 -0700
            Re: populate pulldownbox from query Chuck Anderson <cycletourist@invalid.invalid> - 2011-05-20 20:33 -0600
              Re: populate pulldownbox from query Co <vonclausowitz@gmail.com> - 2011-05-21 00:27 -0700
            Re: populate pulldownbox from query Jerry Stuckle <jstucklex@attglobal.net> - 2011-05-20 22:36 -0400
      Re: populate pulldownbox from query Jerry Stuckle <jstucklex@attglobal.net> - 2011-05-20 18:28 -0400
  Re: populate pulldownbox from query Denis McMahon <denis.m.f.mcmahon@gmail.com> - 2011-05-20 20:06 +0000
    Re: populate pulldownbox from query Jeff North <jnorthau@yahoo.com.au> - 2011-05-21 08:16 +1000
      Re: populate pulldownbox from query Jerry Stuckle <jstucklex@attglobal.net> - 2011-05-20 18:29 -0400
        Re: populate pulldownbox from query Co <vonclausowitz@gmail.com> - 2011-05-20 15:49 -0700
          Re: populate pulldownbox from query Jerry Stuckle <jstucklex@attglobal.net> - 2011-05-20 22:44 -0400
            Re: populate pulldownbox from query Co <vonclausowitz@gmail.com> - 2011-05-21 00:29 -0700
              Re: populate pulldownbox from query TK <tknospa@wejuggle2.com> - 2011-05-21 08:05 -0500
      Re: populate pulldownbox from query Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-05-21 23:19 +0200
  Re: populate pulldownbox from query Jeff North <jnorthau@yahoo.com.au> - 2011-05-21 09:02 +1000
    Re: populate pulldownbox from query Chuck Anderson <cycletourist@invalid.invalid> - 2011-05-20 20:29 -0600

csiph-web