Page 1 of 1

Does anyone use Phorm ? I can't get SELECT MULTIPLE to Work

Posted: Fri Mar 12, 2004 1:25 pm
by tdelobe
The documentation says to use the function ArrayToList and call it from your configuration file.

I can not get the following SELECT drop down to return anything but Array when the user selects multiple options and it sends out the email...

Code: Select all

<select name="WebinarDate&#1111;]" class="multiselect" MULTIPLE size="3">
        <?php
				
			
			$arr_events = getEvents( 100, "webinar", "eventDateStart desc, title desc", "usta_web" );
										
			for( $i=0; $i < count($arr_events); $i++ ) &#123;
			$page = getPageContent( "", $arr_events&#1111;$i], 0 );
			$eventDateStart = $page&#1111;"eventdatestart"];
			$pagename = $page&#1111;"pagename"];
			$currentDate = "$year/0$mon/$mday";
			$title = $page&#1111;"title"];
			
			
			if ($currentDate <= $eventDateStart) &#123;
			echo "<option value="$pagename">$eventDateStart -- $title</option>";
			&#125; else &#123;&#125;
			
			&#125;
		?>
        </select>
Any ideas?
?>

Re: Does anyone use Phorm ? I can't get SELECT MULTIPLE to

Posted: Fri Mar 12, 2004 4:34 pm
by TheBentinel.com
tdelobe wrote:<select name="WebinarDate[]" class="multiselect" MULTIPLE size="3">
Typically (ASP, CGI) a select would return the values to you in a comma-separated list, not an array. So if I selected "apple", "orange", and "pear" from your select list, I would expect $WebinarDate to contain "apple, orange, pear". I think that's a function of the browser, so it shouldn't be different for PHP, but I'm not sure.

I would encourage you to change the name to WebinarDate (lose the brackets) and then split() the returned value into an array.

(If I'm speaking wrong here and PHP works some behind-the-scenes magic on multi-select's, somebody jump in and correct me, please!)

Posted: Fri Mar 12, 2004 4:42 pm
by andre_c
You're doing it correctly. The problem is that you need to treat what you get as an array. Maybe using a foreach statement to get what you want out of it:

Code: Select all

$WebinarDate = $_POST['WebinarDate'];

foreach ($WebinarDate as $value) {
  echo "$value<br />\n";
}