Date: 09/29/98
- Next message: Chris Newbill: "[PHP3] Stupid NT Question"
- Previous message: Cameron Just: "Re: [PHP3] creating images on the fly ?"
- Maybe in reply to: Brown, Patrick: "[PHP3] How to set default value in dropdown list?"
- Next in thread: Kristian Köhntopp: "Re: [PHP3] How to set default value in dropdown list?"
- Reply: Kristian Köhntopp: "Re: [PHP3] How to set default value in dropdown list?"
- Reply: andreas amalesh kempf: "Re: [PHP3] How to set default value in dropdown list?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
At 08:19 PM 29/9/98 -0700, you wrote:
>Hi Michael,
>
>Sorry, but this didn't help. I knew that I needed to get "SELECTED" next to
>one of the items in the list. I just wanted to know if thre is a way to
>dynamically place this depending on the results in a SQL query.
>
>Thanks,
>
>Patrick
try this
<?
$qSCat = msql($dbName,"Select * from category order by Code");
$nSCat = msql_numRows($qSCat);
$i = 1;
while ($i < $nSCat ):
$Selected = "";
$thisCat = msql_result($qSCat,$i,"Code");
if ($SearchCat == $thisCat):
$Selected = " SELECTED ";
endif;
echo "<option VALUE = \"" + $thisCat + "\" $Selected > " +
msql_result($qSCat,$i,"Descr") ;
echo "\n";
$i ++;
endwhile;
?>
</select>
>-----Original Message-----
>From: Michael Brennen [mailto:mbrennen <email protected>]
>Sent: Tuesday, September 29, 1998 8:08 PM
>To: Brown, Patrick
>Cc: 'php3 <email protected>'
>Subject: Re: [PHP3] How to set default value in dropdown list?
>
>
>
>If I've understood your question it is more of an HTML question than a
>PHP question. Put "selected" in the <option> tag to make that the
>selected entry. If you want to select multiple entries, add "multiple"
>to the <select> tag. If I've missed the point let me know.
>
><select multiple name="...">
><option value="some" selected>Some text
><option value="other">Other text
><option value="more" selected>More text
></select>
>
> -- Michael
>
>On Tue, 29 Sep 1998, Brown, Patrick wrote:
>
>> I have four different tables that have a column called StatusID. The
>> default value is 0. I have another table called tblElecStatus that has
>two
>> columns called StatusID and Description. I have created a form drop down
>> based on the tblElecStatus. The code is this:
>>
>> echo "<SELECT NAME=\"CSUStatus\" SIZE=\"1\">\n";
>> $resultStat = odbc_exec($conn, $queryStat);
>> while (odbc_fetch_row($resultStat))
>> {
>> echo "<OPTION VALUE=";
>> echo odbc_result($resultStat,1);
>> echo ">";
>> echo odbc_result($resultStat,2);
>> echo "\n";
>> }
>> echo "</SELECT>\n";
>>
>> Here is my problem. I cannot figure out how to set the default value on
>the
>> drop down list to the value in the first four tabled.
>>
>> Does anyone have any ideas? It would really make my day if this could be
>> done easily.
>>
>> Thanks,
>>
>> Patrick Brown
>>
>
>
>--
>PHP 3 Mailing List http://www.php.net/
>To unsubscribe send an empty message to php3-unsubscribe <email protected>
>To subscribe to the digest list: php3-digest-subscribe <email protected>
>For help: php3-help <email protected> Archive: http://www.php.net/mailsearch.php3
>
>
>
>
-- PHP 3 Mailing List http://www.php.net/ To unsubscribe send an empty message to php3-unsubscribe <email protected> To subscribe to the digest list: php3-digest-subscribe <email protected> For help: php3-help <email protected> Archive: http://www.php.net/mailsearch.php3
- Next message: Chris Newbill: "[PHP3] Stupid NT Question"
- Previous message: Cameron Just: "Re: [PHP3] creating images on the fly ?"
- Maybe in reply to: Brown, Patrick: "[PHP3] How to set default value in dropdown list?"
- Next in thread: Kristian Köhntopp: "Re: [PHP3] How to set default value in dropdown list?"
- Reply: Kristian Köhntopp: "Re: [PHP3] How to set default value in dropdown list?"
- Reply: andreas amalesh kempf: "Re: [PHP3] How to set default value in dropdown list?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

