[PHP] using lists in php and sending

2005-03-08 Thread Ross Hulford
I have a list in php where the user can select 1 or more (rooms book in a 
bb). The following code is part of the form.

select name=rooms size=7 multiple
  option value=Single StandardSingle 
Standard/option
  option value=Single EnSuiteSingle 
EnSuite/option
  option value=Double EnSuiteDouble 
EnSuite/option
  option value=Twin En SuiteTwin En 
Suite/option
  option value=Family StandardFamily 
Standard/option
  option value=Family EnSuiteFamily 
EnSuite/option
  option value=Tripple EnSuiteTripple 
EnSuite/option
/select


And then I send using the mail() functin in PHP using the following code but 
the selected rooms do not display. I know it must be an array of sorts 
please help!!!


msg .= First Name: $firstname \n; $msg .= Second name: $surname \n;
$msg .= Email Address: $email \n; $msg .= Telephone: $telephone \n; $msg 
.= Arrival Date: $arrival \n;
$msg .= Departure Date: $depart \n; $msg .= $adults   Adults  and   $kids 
Children will be staying \n;
$msg .= We will require the following rooms   $rooms\n;
$msg .= Message: $addinfo \n;
$msg .= -\n\n; 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] using lists in php and sending

2005-03-08 Thread Richard Lynch
Ross Hulford wrote:
 I have a list in php where the user can select 1 or more (rooms book in a
 bb). The following code is part of the form.

 select name=rooms size=7 multiple

http://php.net/manual/en/faq.html.php#faq.html.select-multiple

You may want to switch to CHECKBOX since many users have NO CLUE about the
whole control-click thing.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] using lists in php and sending

2005-03-08 Thread Stephen Johnson
First off - do you have global variables turned on?  If not then you need to
collect the data from the $_POST variable.

Also - when you use a multiple select form field the values come across in
an array. 

So you would need to access the data using something like this:
$i=0;
while($rooms[$i]) {
$room_mail .=  $rooms[$i];
} 

Then in your mail section replace $rooms with $room_mail.

HTH

?php
/*

Stephen Johnson c | eh
The Lone Coder

http://www.thelonecoder.com
[EMAIL PROTECTED]

562.924.4454 (office)
562.924.4075 (fax) 

continuing the struggle against bad code

*/ 
?

 From: Ross Hulford [EMAIL PROTECTED]
 Date: Tue, 8 Mar 2005 17:34:22 -
 To: php-general@lists.php.net
 Subject: [PHP] using lists in php and sending
 
 I have a list in php where the user can select 1 or more (rooms book in a
 bb). The following code is part of the form.
 
 select name=rooms size=7 multiple
 option value=Single StandardSingle
 Standard/option
 option value=Single EnSuiteSingle
 EnSuite/option
 option value=Double EnSuiteDouble
 EnSuite/option
 option value=Twin En SuiteTwin En
 Suite/option
 option value=Family StandardFamily
 Standard/option
 option value=Family EnSuiteFamily
 EnSuite/option
 option value=Tripple EnSuiteTripple
 EnSuite/option
   /select
 
 
 And then I send using the mail() functin in PHP using the following code but
 the selected rooms do not display. I know it must be an array of sorts
 please help!!!
 
 
 msg .= First Name: $firstname \n; $msg .= Second name: $surname \n;
 $msg .= Email Address: $email \n; $msg .= Telephone: $telephone \n; $msg
 .= Arrival Date: $arrival \n;
 $msg .= Departure Date: $depart \n; $msg .= $adults   Adults  and   $kids
 Children will be staying \n;
 $msg .= We will require the following rooms   $rooms\n;
 $msg .= Message: $addinfo \n;
 $msg .= -\n\n;
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php