NYCPHP Meetup

NYPHP.org

[nycphp-talk] Newbie question - multi-select list box

Neeraj Rattu neerajrattu at consultant.com
Fri May 2 10:09:29 EDT 2003


Get data from database. You should get it in a Array if you have stored every thing in one field which i hope you have done it.

Now simply explode it and display it.

I could not get any help from the web. So i did it my way. Hope this will help you


<?php
$Parking = explode("," ,$PropertyDetails[Parking_Garaging]);
//$count = count($Parking);
//echo $Parking[$i];
//while($count < 4)
//for($i=0;$i<=5;$i++)
foreach ($Parking as $value)
{
if($value =="Carport")
{
$value1 = $value;
}
if($value =="Single Garage")
{
$value2 = $value;
}
?>
<select name="Parking_Garaging[]"  multiple size="6">
<option value="Carport"
<?php
//if($PropertyDetails[Parking_Garaging]=="Carport")
if($value1 =="Carport")
{											 echo "Selected";
}
?>
>Carport</option>
<option value="Single Garage"
<?php
//if($PropertyDetails[Parking_Garaging]=="Single Garage")
if($value2 =="Single Garage")
{
echo "Selected";
}
?>
>Single Garage</option>

Regards,
Neeraj Rattu
Project Manager(PHP/MYSQL/APACHE/LINUX)
InterLink Marketing Systems
----- Original Message -----
From: Jeff <jsiegel1 at optonline.net>
Date: Fri,  2 May 2003 08:34:31 -0400
To: NYPHP Talk <talk at nyphp.org>
Subject: [nycphp-talk] Newbie question - multi-select list box

I have a multi-select list on a form that posts to itself. However,
while other items, such as text boxes retain their values (I'm using
something like <?php echo $_POST['DL_sAddr2'] ?> ) I'm scratchin' my
head on how to do the same with the multi-select list.

TIA,

Jeff



--- Unsubscribe at http://nyphp.org/list/ ---



-- 
__________________________________________________________
Sign-up for your own FREE Personalized E-mail at Mail.com
http://www.mail.com/?sr=signup




More information about the talk mailing list