NYCPHP Meetup

NYPHP.org

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

Jeff jsiegel1 at optonline.net
Fri May 2 10:28:59 EDT 2003


Actually, I wasn't going to store it in a single field. Each item needed
to be stored in a separate field. But I'll hang on to this code since it
will help me with some other problems I'm working on.

Jeff

-----Original Message-----
From: Neeraj Rattu [mailto:neerajrattu at consultant.com] 
Sent: Friday, May 02, 2003 9:10 AM
To: NYPHP Talk
Subject: Re: [nycphp-talk] Newbie question - multi-select list box


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







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



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






More information about the talk mailing list