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


Groups > comp.lang.php > #1695 > unrolled thread

populate pulldownbox from query

Started byCo <vonclausowitz@gmail.com>
First post2011-05-20 11:30 -0700
Last post2011-05-20 20:29 -0600
Articles 20 on this page of 21 — 9 participants

Back to article view | Back to comp.lang.php


Contents

  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

Page 1 of 2  [1] 2  Next page →


#1695 — populate pulldownbox from query

FromCo <vonclausowitz@gmail.com>
Date2011-05-20 11:30 -0700
Subjectpopulate pulldownbox from query
Message-ID<7e34dca3-a1f3-4bdf-acbd-8288e6a30581@gu8g2000vbb.googlegroups.com>
Hi All,

I am having trouble populating a pulldownbox with records from a table
in mySQL database.

I have a table with personnel records.
One of the fields is partner which holds a numeric value pointing to
the id of another record.
I am trying to get the value of the currently selected person's
partner.

for example:
id=1 name=John partner=2
id=2 name=Jane partner=1

With the code I use I do get the pulldownbox filled but it doesn't
display the name right partner info in the box.

$query="SELECT id, firstname, lastname, rank FROM myMembers WHERE id
<> $id ORDER BY lastname";
$result = mysql_query ($query);
echo "<select name=partner class=formFields id=partner
value=''>Partner</option>";
while($nt=mysql_fetch_array($result)){//Array or records stored in $nt
echo "<option value=$nt[id]>$nt[rank] $nt[firstname] $nt[lastname]</
option>";
/* Option values are added by looping through the array */
}
echo "<option value=$partner>$nt[rank] $nt[firstname] $nt[lastname]</
option>";
echo "</select>";// Closing of list box
?>

Can anyone help me here?

Regards
Marco

[toc] | [next] | [standalone]


#1697

FromLuuk <Luuk@invalid.lan>
Date2011-05-20 20:40 +0200
Message-ID<4dd6b59e$0$49041$e4fe514c@news.xs4all.nl>
In reply to#1695
On 20-05-2011 20:30, Co wrote:
> echo "<option value=$partner>$nt[rank] $nt[firstname] $nt[lastname]</

echo "<option value=$partner>$nt['rank'] $nt['firstname'] $nt['lastname']</

-- 
Luuk

[toc] | [prev] | [next] | [standalone]


#1699

FromJerry Stuckle <jstucklex@attglobal.net>
Date2011-05-20 15:13 -0400
Message-ID<ir6efv$dp9$1@dont-email.me>
In reply to#1695
On 5/20/2011 2:30 PM, Co wrote:
> echo "<option value=$partner>$nt[rank] $nt[firstname] $nt[lastname]</
> option>";

echo "<option value=$partner>{$nt[rank]} {$nt[firstname]} 
{$nt[lastname]}</option>";


-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[toc] | [prev] | [next] | [standalone]


#1701

FromDenis McMahon <denis.m.f.mcmahon@gmail.com>
Date2011-05-20 20:19 +0000
Message-ID<4dd6ccb8$0$30688$bed64819@gradwell.net>
In reply to#1699
On Fri, 20 May 2011 15:13:01 -0400, Jerry Stuckle wrote:

> On 5/20/2011 2:30 PM, Co wrote:
>> echo "<option value=$partner>$nt[rank] $nt[firstname] $nt[lastname]</
>> option>";
> 
> echo "<option value=$partner>{$nt[rank]} {$nt[firstname]}
> {$nt[lastname]}</option>";

Hmm

I thought:

echo "<option value='$partner'>{$nt['rank']} {$nt['firstname']}
{$nt['lastname']}</option>";

But I'm failing to find an appropriate page in the manual for a 
definitive answer.

Rgds

Denis McMahon

[toc] | [prev] | [next] | [standalone]


#1702

FromMichael Fesser <netizen@gmx.de>
Date2011-05-20 22:41 +0200
Message-ID<gdkdt6huopkjg85j6jqapo46usu87krpcu@mfesser.de>
In reply to#1701
.oO(Denis McMahon)

>On Fri, 20 May 2011 15:13:01 -0400, Jerry Stuckle wrote:
>
>> On 5/20/2011 2:30 PM, Co wrote:
>>> echo "<option value=$partner>$nt[rank] $nt[firstname] $nt[lastname]</
>>> option>";
>> 
>> echo "<option value=$partner>{$nt[rank]} {$nt[firstname]}
>> {$nt[lastname]}</option>";
>
>Hmm
>
>I thought:
>
>echo "<option value='$partner'>{$nt['rank']} {$nt['firstname']}
>{$nt['lastname']}</option>";

Correct.

>But I'm failing to find an appropriate page in the manual for a 
>definitive answer.

Complex (curly) syntax
http://www.php.net/manual/en/language.types.string.php#language.types.string.parsing.complex

Micha

[toc] | [prev] | [next] | [standalone]


#1711

FromChuck Anderson <cycletourist@invalid.invalid>
Date2011-05-20 16:44 -0600
Message-ID<ir6qss$v76$1@dont-email.me>
In reply to#1702
Michael Fesser wrote:
> .oO(Denis McMahon)
>
>   
>> On Fri, 20 May 2011 15:13:01 -0400, Jerry Stuckle wrote:
>>
>>     
>>> On 5/20/2011 2:30 PM, Co wrote:
>>>       
>>>> echo "<option value=$partner>$nt[rank] $nt[firstname] $nt[lastname]</
>>>> option>";
>>>>         
>>> echo "<option value=$partner>{$nt[rank]} {$nt[firstname]}
>>> {$nt[lastname]}</option>";
>>>       
>> Hmm
>>
>> I thought:
>>
>> echo "<option value='$partner'>{$nt['rank']} {$nt['firstname']}
>> {$nt['lastname']}</option>";
>>     
>
> Correct.
>
>   
>> But I'm failing to find an appropriate page in the manual for a 
>> definitive answer.
>>     
>
> Complex (curly) syntax
> http://www.php.net/manual/en/language.types.string.php#language.types.string.parsing.complex
>
> Micha
>   

Since constants are not evaluated within strings, the quotes on array 
keys and curly braces are not needed.

(from http://www.php.net/manual/en/language.types.array.php )
// The following is okay, as it's inside a string. Constants are not 
looked for
// within strings, so no E_NOTICE occurs here
print "Hello $arr[fruit]"; // Hello apple


The OP's original syntax is valid.
echo "<option value=$nt[id]>$nt[rank] $nt[firstname] 
$nt[lastname]</option>";

The formatting of the "<option ..." line is not the problem.

I'd put print_r($nt) within the while loop and look at the query results.

-- 
*****************************
 Chuck Anderson • Boulder, CO
  http://cycletourist.com
 Turn Off, Tune Out, Drop In
*****************************

[toc] | [prev] | [next] | [standalone]


#1714

FromCo <vonclausowitz@gmail.com>
Date2011-05-20 15:56 -0700
Message-ID<a3af0910-a0d5-408b-be66-890d86b7795d@e26g2000vbz.googlegroups.com>
In reply to#1711
On 21 mei, 00:44, Chuck Anderson <cycletour...@invalid.invalid> wrote:
> Michael Fesser wrote:
> > .oO(Denis McMahon)
>
> >> On Fri, 20 May 2011 15:13:01 -0400, Jerry Stuckle wrote:
>
> >>> On 5/20/2011 2:30 PM, Co wrote:
>
> >>>> echo "<option value=$partner>$nt[rank] $nt[firstname] $nt[lastname]</
> >>>> option>";
>
> >>> echo "<option value=$partner>{$nt[rank]} {$nt[firstname]}
> >>> {$nt[lastname]}</option>";
>
> >> Hmm
>
> >> I thought:
>
> >> echo "<option value='$partner'>{$nt['rank']} {$nt['firstname']}
> >> {$nt['lastname']}</option>";
>
> > Correct.
>
> >> But I'm failing to find an appropriate page in the manual for a
> >> definitive answer.
>
> > Complex (curly) syntax
> >http://www.php.net/manual/en/language.types.string.php#language.types...
>
> > Micha
>
> Since constants are not evaluated within strings, the quotes on array
> keys and curly braces are not needed.
>
> (fromhttp://www.php.net/manual/en/language.types.array.php)
> // The following is okay, as it's inside a string. Constants are not
> looked for
> // within strings, so no E_NOTICE occurs here
> print "Hello $arr[fruit]"; // Hello apple
>
> The OP's original syntax is valid.
> echo "<option value=$nt[id]>$nt[rank] $nt[firstname]
> $nt[lastname]</option>";
>
> The formatting of the "<option ..." line is not the problem.
>
> I'd put print_r($nt) within the while loop and look at the query results.
>
> --
> *****************************
>  Chuck Anderson Boulder, CO
>  http://cycletourist.com
>  Turn Off, Tune Out, Drop In
> *****************************

Chuck,

you are right. All the values get loaded in the listbox.
However the box itself stays empty. That shouldnt be.
There should be the name of the partner of the user in there.
Because it is represented by a numeric value, I think it gives a
problem.

Marco

[toc] | [prev] | [next] | [standalone]


#1719

FromChuck Anderson <cycletourist@invalid.invalid>
Date2011-05-20 20:33 -0600
Message-ID<ir78a9$200$2@dont-email.me>
In reply to#1714
Co wrote:
> On 21 mei, 00:44, Chuck Anderson <cycletour...@invalid.invalid> wrote:
>   
>> Michael Fesser wrote:
>>     
>>> .oO(Denis McMahon)
>>>       
>>>> On Fri, 20 May 2011 15:13:01 -0400, Jerry Stuckle wrote:
>>>>         
>>>>> On 5/20/2011 2:30 PM, Co wrote:
>>>>>           
>>>>>> echo "<option value=$partner>$nt[rank] $nt[firstname] $nt[lastname]</
>>>>>> option>";
>>>>>>             
>>>>> echo "<option value=$partner>{$nt[rank]} {$nt[firstname]}
>>>>> {$nt[lastname]}</option>";
>>>>>           
>>>> Hmm
>>>>         
>>>> I thought:
>>>>         
>>>> echo "<option value='$partner'>{$nt['rank']} {$nt['firstname']}
>>>> {$nt['lastname']}</option>";
>>>>         
>>> Correct.
>>>       
>>>> But I'm failing to find an appropriate page in the manual for a
>>>> definitive answer.
>>>>         
>>> Complex (curly) syntax
>>> http://www.php.net/manual/en/language.types.string.php#language.types...
>>>       
>>> Micha
>>>       
>> Since constants are not evaluated within strings, the quotes on array
>> keys and curly braces are not needed.
>>
>> (fromhttp://www.php.net/manual/en/language.types.array.php)
>> // The following is okay, as it's inside a string. Constants are not
>> looked for
>> // within strings, so no E_NOTICE occurs here
>> print "Hello $arr[fruit]"; // Hello apple
>>
>> The OP's original syntax is valid.
>> echo "<option value=$nt[id]>$nt[rank] $nt[firstname]
>> $nt[lastname]</option>";
>>
>> The formatting of the "<option ..." line is not the problem.
>>
>> I'd put print_r($nt) within the while loop and look at the query results.
>>
>>     
> Chuck,
>
> you are right. All the values get loaded in the listbox.
> However the box itself stays empty. That shouldnt be.
> There should be the name of the partner of the user in there.
> Because it is represented by a numeric value, I think it gives a
> problem.
>
>   

Did you try my print_r suggestion - and look at the page source for it's 
output - or error messages - hidden in the select block?

-- 
*****************************
 Chuck Anderson • Boulder, CO
  http://cycletourist.com
 Turn Off, Tune Out, Drop In
*****************************

[toc] | [prev] | [next] | [standalone]


#1726

FromCo <vonclausowitz@gmail.com>
Date2011-05-21 00:27 -0700
Message-ID<cca0f548-56b0-4aa6-b52a-8f517adb0d9a@l6g2000vbn.googlegroups.com>
In reply to#1719
On 21 mei, 04:33, Chuck Anderson <cycletour...@invalid.invalid> wrote:
> Co wrote:
> > On 21 mei, 00:44, Chuck Anderson <cycletour...@invalid.invalid> wrote:
>
> >> Michael Fesser wrote:
>
> >>> .oO(Denis McMahon)
>
> >>>> On Fri, 20 May 2011 15:13:01 -0400, Jerry Stuckle wrote:
>
> >>>>> On 5/20/2011 2:30 PM, Co wrote:
>
> >>>>>> echo "<option value=$partner>$nt[rank] $nt[firstname] $nt[lastname]</
> >>>>>> option>";
>
> >>>>> echo "<option value=$partner>{$nt[rank]} {$nt[firstname]}
> >>>>> {$nt[lastname]}</option>";
>
> >>>> Hmm
>
> >>>> I thought:
>
> >>>> echo "<option value='$partner'>{$nt['rank']} {$nt['firstname']}
> >>>> {$nt['lastname']}</option>";
>
> >>> Correct.
>
> >>>> But I'm failing to find an appropriate page in the manual for a
> >>>> definitive answer.
>
> >>> Complex (curly) syntax
> >>>http://www.php.net/manual/en/language.types.string.php#language.types...
>
> >>> Micha
>
> >> Since constants are not evaluated within strings, the quotes on array
> >> keys and curly braces are not needed.
>
> >> (fromhttp://www.php.net/manual/en/language.types.array.php)
> >> // The following is okay, as it's inside a string. Constants are not
> >> looked for
> >> // within strings, so no E_NOTICE occurs here
> >> print "Hello $arr[fruit]"; // Hello apple
>
> >> The OP's original syntax is valid.
> >> echo "<option value=$nt[id]>$nt[rank] $nt[firstname]
> >> $nt[lastname]</option>";
>
> >> The formatting of the "<option ..." line is not the problem.
>
> >> I'd put print_r($nt) within the while loop and look at the query results.
>
> > Chuck,
>
> > you are right. All the values get loaded in the listbox.
> > However the box itself stays empty. That shouldnt be.
> > There should be the name of the partner of the user in there.
> > Because it is represented by a numeric value, I think it gives a
> > problem.
>
> Did you try my print_r suggestion - and look at the page source for it's
> output - or error messages - hidden in the select block?
>
> --
> *****************************
>  Chuck Anderson • Boulder, CO
>  http://cycletourist.com
>  Turn Off, Tune Out, Drop In
> *****************************

Chuck,

it doesn't show probably it gets filled before I see the page.

Marco

[toc] | [prev] | [next] | [standalone]


#1721

FromJerry Stuckle <jstucklex@attglobal.net>
Date2011-05-20 22:36 -0400
Message-ID<ir78fq$53s$2@dont-email.me>
In reply to#1714
On 5/20/2011 6:56 PM, Co wrote:
> On 21 mei, 00:44, Chuck Anderson<cycletour...@invalid.invalid>  wrote:
>> Michael Fesser wrote:
>>> .oO(Denis McMahon)
>>
>>>> On Fri, 20 May 2011 15:13:01 -0400, Jerry Stuckle wrote:
>>
>>>>> On 5/20/2011 2:30 PM, Co wrote:
>>
>>>>>> echo "<option value=$partner>$nt[rank] $nt[firstname] $nt[lastname]</
>>>>>> option>";
>>
>>>>> echo "<option value=$partner>{$nt[rank]} {$nt[firstname]}
>>>>> {$nt[lastname]}</option>";
>>
>>>> Hmm
>>
>>>> I thought:
>>
>>>> echo "<option value='$partner'>{$nt['rank']} {$nt['firstname']}
>>>> {$nt['lastname']}</option>";
>>
>>> Correct.
>>
>>>> But I'm failing to find an appropriate page in the manual for a
>>>> definitive answer.
>>
>>> Complex (curly) syntax
>>> http://www.php.net/manual/en/language.types.string.php#language.types...
>>
>>> Micha
>>
>> Since constants are not evaluated within strings, the quotes on array
>> keys and curly braces are not needed.
>>
>> (fromhttp://www.php.net/manual/en/language.types.array.php)
>> // The following is okay, as it's inside a string. Constants are not
>> looked for
>> // within strings, so no E_NOTICE occurs here
>> print "Hello $arr[fruit]"; // Hello apple
>>
>> The OP's original syntax is valid.
>> echo "<option value=$nt[id]>$nt[rank] $nt[firstname]
>> $nt[lastname]</option>";
>>
>> The formatting of the "<option ..." line is not the problem.
>>
>> I'd put print_r($nt) within the while loop and look at the query results.
>>
>> --
>> *****************************
>>   Chuck Anderson Boulder, CO
>>   http://cycletourist.com
>>   Turn Off, Tune Out, Drop In
>> *****************************
>
> Chuck,
>
> you are right. All the values get loaded in the listbox.
> However the box itself stays empty. That shouldnt be.
> There should be the name of the partner of the user in there.
> Because it is represented by a numeric value, I think it gives a
> problem.
>
> Marco

Marco, that part is strictly an HTML problem.  Try alt.html.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[toc] | [prev] | [next] | [standalone]


#1708

FromJerry Stuckle <jstucklex@attglobal.net>
Date2011-05-20 18:28 -0400
Message-ID<ir6pui$pkl$1@dont-email.me>
In reply to#1701
On 5/20/2011 4:19 PM, Denis McMahon wrote:
> On Fri, 20 May 2011 15:13:01 -0400, Jerry Stuckle wrote:
>
>> On 5/20/2011 2:30 PM, Co wrote:
>>> echo "<option value=$partner>$nt[rank] $nt[firstname] $nt[lastname]</
>>> option>";
>>
>> echo "<option value=$partner>{$nt[rank]} {$nt[firstname]}
>> {$nt[lastname]}</option>";
>
> Hmm
>
> I thought:
>
> echo "<option value='$partner'>{$nt['rank']} {$nt['firstname']}
> {$nt['lastname']}</option>";
>
> But I'm failing to find an appropriate page in the manual for a
> definitive answer.
>
> Rgds
>
> Denis McMahon

Yup, you're right - I was concentrating on the braces and forgot the quotes.

Mea culpa.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[toc] | [prev] | [next] | [standalone]


#1700

FromDenis McMahon <denis.m.f.mcmahon@gmail.com>
Date2011-05-20 20:06 +0000
Message-ID<4dd6c9cd$0$30688$bed64819@gradwell.net>
In reply to#1695
On Fri, 20 May 2011 11:30:02 -0700, Co wrote:

> Can anyone help me here?

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>';

Rgds

Denis McMahon

[toc] | [prev] | [next] | [standalone]


#1705

FromJeff North <jnorthau@yahoo.com.au>
Date2011-05-21 08:16 +1000
Message-ID<dipdt6htdougvbgfj5pfribnhgc1cg68n3@4ax.com>
In reply to#1700
On 20 May 2011 20:06:38 GMT, in comp.lang.php Denis McMahon
<denis.m.f.mcmahon@gmail.com>
<4dd6c9cd$0$30688$bed64819@gradwell.net> wrote:

>| On Fri, 20 May 2011 11:30:02 -0700, Co wrote:
>| 
>| > Can anyone help me here?
>| 
>| 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>';
>| 
>| Rgds
>| 
>| Denis McMahon
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.

[toc] | [prev] | [next] | [standalone]


#1709

FromJerry Stuckle <jstucklex@attglobal.net>
Date2011-05-20 18:29 -0400
Message-ID<ir6q0u$pkl$2@dont-email.me>
In reply to#1705
On 5/20/2011 6:16 PM, Jeff North wrote:
> On 20 May 2011 20:06:38 GMT, in comp.lang.php Denis McMahon
> <denis.m.f.mcmahon@gmail.com>
> <4dd6c9cd$0$30688$bed64819@gradwell.net>  wrote:
>
>> | On Fri, 20 May 2011 11:30:02 -0700, Co wrote:
>> |
>> |>  Can anyone help me here?
>> |
>> | 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>';
>> |
>> | Rgds
>> |
>> | Denis McMahon
> 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.

I believe that's why he said SHOULD, and not MUST.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[toc] | [prev] | [next] | [standalone]


#1712

FromCo <vonclausowitz@gmail.com>
Date2011-05-20 15:49 -0700
Message-ID<c3bd334f-c414-4f73-b186-2b042164b522@p23g2000vbl.googlegroups.com>
In reply to#1709
On 21 mei, 00:29, Jerry Stuckle <jstuck...@attglobal.net> wrote:
> On 5/20/2011 6:16 PM, Jeff North wrote:
>
>
>
>
>
>
>
>
>
> > On 20 May 2011 20:06:38 GMT, in comp.lang.php Denis McMahon
> > <denis.m.f.mcma...@gmail.com>
> > <4dd6c9cd$0$30688$bed64...@gradwell.net>  wrote:
>
> >> | On Fri, 20 May 2011 11:30:02 -0700, Co wrote:
> >> |
> >> |>  Can anyone help me here?
> >> |
> >> | 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>';
> >> |
> >> | Rgds
> >> |
> >> | Denis McMahon
> > 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.
>
> I believe that's why he said SHOULD, and not MUST.
>
> --
> ==================
> Remove the "x" from my email address
> Jerry Stuckle
> JDS Computer Training Corp.
> jstuck...@attglobal.net
> ==================

sorry Jerry you lost me.
The form I am using this on is an profile edit page.
The user should get all his profile data and be able to change it and
save it.
That is why I need the value from the database along with the names
loaded in the listbox.

Marco

[toc] | [prev] | [next] | [standalone]


#1722

FromJerry Stuckle <jstucklex@attglobal.net>
Date2011-05-20 22:44 -0400
Message-ID<ir78ue$7jg$1@dont-email.me>
In reply to#1712
On 5/20/2011 6:49 PM, Co wrote:
> On 21 mei, 00:29, Jerry Stuckle<jstuck...@attglobal.net>  wrote:
>> On 5/20/2011 6:16 PM, Jeff North wrote:
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>> On 20 May 2011 20:06:38 GMT, in comp.lang.php Denis McMahon
>>> <denis.m.f.mcma...@gmail.com>
>>> <4dd6c9cd$0$30688$bed64...@gradwell.net>    wrote:
>>
>>>> | On Fri, 20 May 2011 11:30:02 -0700, Co wrote:
>>>> |
>>>> |>    Can anyone help me here?
>>>> |
>>>> | 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>';
>>>> |
>>>> | Rgds
>>>> |
>>>> | Denis McMahon
>>> 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.
>>
>> I believe that's why he said SHOULD, and not MUST.
>>
>
> sorry Jerry you lost me.
> The form I am using this on is an profile edit page.
> The user should get all his profile data and be able to change it and
> save it.
> That is why I need the value from the database along with the names
> loaded in the listbox.
>
> Marco

Marco, that comment wasn't directed at you.

Your first problem is - are you getting the correct data from the 
database?  If not, you need to do that first - which is a MySQL 
question, not a PHP one (and should be asked in comp.databases.mysql).

If you are getting the correct information back from the database, 
what's wrong with the partner name?


-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[toc] | [prev] | [next] | [standalone]


#1727

FromCo <vonclausowitz@gmail.com>
Date2011-05-21 00:29 -0700
Message-ID<22f71c1f-244e-4eac-9c19-77f8a5901258@j28g2000vbp.googlegroups.com>
In reply to#1722
On 21 mei, 04:44, Jerry Stuckle <jstuck...@attglobal.net> wrote:
> On 5/20/2011 6:49 PM, Co wrote:
>
>
>
>
>
>
>
>
>
> > On 21 mei, 00:29, Jerry Stuckle<jstuck...@attglobal.net>  wrote:
> >> On 5/20/2011 6:16 PM, Jeff North wrote:
>
> >>> On 20 May 2011 20:06:38 GMT, in comp.lang.php Denis McMahon
> >>> <denis.m.f.mcma...@gmail.com>
> >>> <4dd6c9cd$0$30688$bed64...@gradwell.net>    wrote:
>
> >>>> | On Fri, 20 May 2011 11:30:02 -0700, Co wrote:
> >>>> |
> >>>> |>    Can anyone help me here?
> >>>> |
> >>>> | 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>';
> >>>> |
> >>>> | Rgds
> >>>> |
> >>>> | Denis McMahon
> >>> 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.
>
> >> I believe that's why he said SHOULD, and not MUST.
>
> > sorry Jerry you lost me.
> > The form I am using this on is an profile edit page.
> > The user should get all his profile data and be able to change it and
> > save it.
> > That is why I need the value from the database along with the names
> > loaded in the listbox.
>
> > Marco
>
> Marco, that comment wasn't directed at you.
>
> Your first problem is - are you getting the correct data from the
> database?  If not, you need to do that first - which is a MySQL
> question, not a PHP one (and should be asked in comp.databases.mysql).
>
> If you are getting the correct information back from the database,
> what's wrong with the partner name?
>
> --
> ==================
> Remove the "x" from my email address
> Jerry Stuckle
> JDS Computer Training Corp.
> jstuck...@attglobal.net
> ==================

I do get the right data from the database.
The listbox gets filled correctly.

It is just that the name which is currently set as partner doesn't
show in the box.
I tried to fix that with:
echo "<option value='$partner'>{$nt['rank']} {$nt['firstname']}
{$nt['lastname']}</option>";
Problem is that I cannot do it at first I have to wait until the do
while loop for filling the listbox
has run.

Marco

[toc] | [prev] | [next] | [standalone]


#1742

FromTK <tknospa@wejuggle2.com>
Date2011-05-21 08:05 -0500
Message-ID<ir8d9v$pfm$1@dont-email.me>
In reply to#1727
On 5/21/2011 2:29 AM, Co wrote:

> I do get the right data from the database.
> The listbox gets filled correctly.
>
> It is just that the name which is currently set as partner doesn't
> show in the box.
> I tried to fix that with:
> echo "<option value='$partner'>{$nt['rank']} {$nt['firstname']}
> {$nt['lastname']}</option>";
> Problem is that I cannot do it at first I have to wait until the do
> while loop for filling the listbox
> has run.
Inset this in your while loop:
// Substitue your variable names

$f='';
if($rowAff['c_id']==$row['ch_id']) {$f="selected=\"selected\"";}		
echo "<option $f 
value=\"{$rowAff['c_id']}\">{$rowAff['church']}</option>\n";}

$f makes the current choice show in the option box.  If I understood the 
problem correctly.


-- 
TK ~ aka Terry Kimpling
http://wejuggle2.com/
If you can be legally insane, can you not be illegally insane?

[toc] | [prev] | [next] | [standalone]


#1753

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2011-05-21 23:19 +0200
Message-ID<8792709.pXjbOYK8lx@PointedEars.de>
In reply to#1705
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

[toc] | [prev] | [next] | [standalone]


#1716

FromJeff North <jnorthau@yahoo.com.au>
Date2011-05-21 09:02 +1000
Message-ID<3osdt65ov19sgu72l7mdma0fjl0pi9p5bg@4ax.com>
In reply to#1695
On Fri, 20 May 2011 11:30:02 -0700 (PDT), in comp.lang.php Co
<vonclausowitz@gmail.com>
<7e34dca3-a1f3-4bdf-acbd-8288e6a30581@gu8g2000vbb.googlegroups.com>
wrote:

>| Hi All,
>| 
>| I am having trouble populating a pulldownbox with records from a table
>| in mySQL database.
>| 
>| I have a table with personnel records.
>| One of the fields is partner which holds a numeric value pointing to
>| the id of another record.
>| I am trying to get the value of the currently selected person's
>| partner.
>| 
>| for example:
>| id=1 name=John partner=2
>| id=2 name=Jane partner=1
>| 
>| With the code I use I do get the pulldownbox filled but it doesn't
>| display the name right partner info in the box.
>| 
>| $query="SELECT id, firstname, lastname, rank FROM myMembers WHERE id
>| <> $id ORDER BY lastname";
>| $result = mysql_query ($query);
>| echo "<select name=partner class=formFields id=partner
>| value=''>Partner</option>";
>| while($nt=mysql_fetch_array($result)){//Array or records stored in $nt
>| echo "<option value=$nt[id]>$nt[rank] $nt[firstname] $nt[lastname]</
>| option>";
>| /* Option values are added by looping through the array */
>| }
>| echo "<option value=$partner>$nt[rank] $nt[firstname] $nt[lastname]</
>| option>";
>| echo "</select>";// Closing of list box
>| ?>
>| 
>| Can anyone help me here?
>| 
>| Regards
>| Marco

When you View Source of the page what do you see where the lists are
supposed to be (there could be php error messages hiding there).

[toc] | [prev] | [next] | [standalone]


Page 1 of 2  [1] 2  Next page →

Back to top | Article view | comp.lang.php


csiph-web