[thelist] Multiple Select??

Jon Haworth jhaworth at witanjardine.co.uk
Fri Sep 21 14:12:27 CDT 2001


Your data is stored in an array now, so you can reference it with
$Type_of_Event[1], $Type_of_Event[2] etc.

There is a handy way to step through all the elements in an array, if you're
using PHP4 (see below if you're not)

With PHP4: 

<?php
# snip
print "eMail:$eMail<br>\n";
print "Date of Event: $Date_of_Event<br>\n";
print "Type of Event: ";
foreach ($Type_of_Event as $current) {
	print "$current, ";
}
print "<br>\n";
# snip
?>

You'll have to do some fiddling to get the formatting right, but hopefully
you see the principle. (http://www.php.net/foreach)


If you only have PHP3 (the reason I mention this is I've noticed .php3 as
your extension) you have to replace foreach() with a do..while:

<?php
# snip
print "eMail:$eMail<br>\n";
print "Date of Event: $Date_of_Event<br>\n";
print "Type of Event: ";
reset ($Type_of_Event);
while (list (, $current) = each ($Type_of_Event)) {
    echo "Value: $value<br>\n";
}
print "<br>\n";# snip
?>


HTH
Jon



-----Original Message-----
From: McAtee, Malcolm [mailto:MMcAtee at philamuseum.org]
Sent: 21 September 2001 15:52
To: thelist at lists.evolt.org
Subject: RE: [thelist] Multiple Select??


<select name="Type_of_Event[]" size="6" multiple> --


I now recieve Type of Event: Array.....
Do I need to add something to the results page? (see below)
I apologize for the simple questions, did I mention this is my first PHP
app?

TIA Malcolm

 
You Have Entered the Following Information:<br>

<?php
print "Date:$Date<br>\n";
print "Company:$Company<br>\n";
print "Contact:$Contact<br>\n";
print "Address:$Address<br>\n";
print "Telephone:$Telephone<br>\n";
print "FAX:$FAX<br>\n";
print "eMail:$eMail<br>\n";
print "Date of Event:$Date_of_Event<br>\n";
print "Type of Event:$Type_of_Event<br>\n";
print "Number of Attendees:$Number_of_Attendees<br>\n";
print "Desired Location:$Desired_Location<br>\n";
print "Special Needs:$Special_Needs<br>\n";
 ?>
 

<?php
 mail
("mmcatee at philamuseum.org", "Facilities Inquiry", 
"Date:$Date
 Company:$Company
 Contact:$Contact
 Address:$Address
 Telephone:$Telephone
 eMail:$eMail
 Date of Event:$Date_of_Event
 Type of Event:$Type_of_Event
 Number of Attendees:$Number_of_Attendees
 Desired Location:$Desired_Location
 Special Needs:$Special_Needs
","FROM:Inquiry_Form")
?>






//---------------//
Malcolm J. Mcatee
Web Designer
Philadelphia Museum of Art
215-684-7748
mmcatee at philamuseum.org
//---------------//

-----Original Message-----
From: Carl-Johan Kihlbom [mailto:div at newcode.se]
Sent: Friday, September 21, 2001 8:11 AM
To: thelist at lists.evolt.org
Subject: Re: [thelist] Multiple Select??


>
>> I am creating a form to be used in a simple PHP/email
>> app. Everything seems to be working well except that my multiple
>> select lists seem to pass only the first value in the list.  Please
>> see the code below:
>>
>>        <select name="Type_of_Event" size="6" multiple>

You should use <select name="Type_of_Event[]" size="6" multiple>. Then 
the values will be stored in the array $Type_ofEvent.

/ Carl-Johan

---------------------------------------
For unsubscribe and other options, including
the Tip Harvester and archive of TheList go to:
http://lists.evolt.org Workers of the Web, evolt ! 

---------------------------------------
For unsubscribe and other options, including
the Tip Harvester and archive of TheList go to:
http://lists.evolt.org Workers of the Web, evolt ! 


**********************************************************************
'The information included in this Email is of a confidential nature and is 
intended only for the addressee. If you are not the intended addressee, 
any disclosure, copying or distribution by you is prohibited and may be 
unlawful. Disclosure to any party other than the addressee, whether 
inadvertent or otherwise is not intended to waive privilege or confidentiality'

**********************************************************************





More information about the thelist mailing list