Mutiple Selects Problem

JavaScript and client side scripting.

Moderator: General Moderators

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

Mutiple Selects Problem

Post by tdelobe »

I am having trouble getting a multiselect to work in a form that sends the results via email. I can get it to select multiple line items BUT it only sends the top one for some reason. Any idea why?

Code: Select all

select name="WebinarDate" class="multiselect" MULTIPLE size="3">
<option value="web2004_0422" name="TriplePlay1">2004/04/22 -- USTA Webinar - The Triple Play: FTTP</option>
		<option value="web2004_0408" name="TriplePlay2">2004/04/08 -- USTA Webinar - The Triple Play: Video</option>
		<option value="web2004_0325" name="TriplePlay3">2004/03/25 -- USTA Webinar - The Triple Play: MPLS and VoIP</option>
        </select>
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 need to set the name as WebinarDate[] and then treat it as an array when you handle it on your php script.
tdelobe
Forum Commoner
Posts: 41
Joined: Thu Aug 07, 2003 2:28 pm
Location: washington, dc

hmmm

Post by tdelobe »

So, how would I do that given this is what I have now?

Code: Select all

<?php
<select name="WebinarDate" 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++ ) {
			$page = getPageContent( "", $arr_events[$i], 0 );
			$eventDateStart = $page["eventdatestart"];
			$pagename = $page["pagename"];
			$currentDate = "$year/0$mon/$mday";
			$title = $page["title"];
			
			if ($currentDate <= $eventDateStart) {
			echo "<option value="$pagename" name="Date$pagename">$eventDateStart -- $title</option>";
			} else {}
			
			}
		?>
        </select>
?>
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 »

simply add []:

Code: Select all

<select name="WebinarDate&#1111;]" class="multiselect" MULTIPLE size="3">
but on the action page, when you do $WebinarDate = $_POST['WebinarDate']; , $WebinarDate will be an array instead of a variable
Post Reply