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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
tdelobe
Forum Commoner
Posts: 41
Joined: Thu Aug 07, 2003 2:28 pm
Location: washington, dc

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

Post 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?
?>
TheBentinel.com
Forum Contributor
Posts: 282
Joined: Wed Mar 10, 2004 1:52 pm
Location: Columbus, Ohio

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

Post 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!)
User avatar
andre_c
Forum Contributor
Posts: 412
Joined: Sun Feb 29, 2004 6:49 pm
Location: Salt Lake City, Utah

Post 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";
}
Post Reply