Location: PHPKode > scripts > PSPLMultiselect > psplmultiselect/sample.php
<?php

	// please not this is example for PHP
	// this is used to generate PSPL MultiSelect box codes at server side
	// 
	
	//include the pspl_multiselect class
	require_once( "pspl_multiselect.class.php" );
	
	//define generator for style 1
	$selectGenerator = new PSPLMultiSelect( "arrow_on1.gif", "arrow_off1.gif","arrow1", "optionTextBox1", "optionDiv1", "cell1", "cellHover1", "cellSelected1", "selBox1" );
	
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Multiple Select Drop Down Box  - multiselect dropdown select box made in html,javascript, w3c compliant - test 0  </title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!-- include the stylesheet for PSPL MultiSelect -->
<link href="pspl_multiselect.css" rel="stylesheet" type="text/css">
<!-- include javascript for PSPL MultiSelect -->
<script language="javascript" src="pspl_multiselect.js"></script>
</style>
</head>
<body >

<br>
<?php
/*
	code sample, generator format 1  
	in this format the options also have value property like
		<option value="somevalue">option text</option>
		
	this example show how such PSPL Multi Select Boxes can be created using
	the PSPLMultiselect class in PHP
*/
	//define the options => option text pairs for select box
	$sampleOptions1 = array( "FEB" => "February",
							 "MAR" => "March",
							 "APR" => "April",
							 "MAY" => "May",
							 "JUN" => "JUNE" );
	//define array of selected options
	$selectedOptions1 = array("FEB", "APR" );
	
	//print the multiselect
	$selectGenerator->PrintMultiSelect( "months", $sampleOptions1, $selectedOptions1, "YES" );

?>

<br>

<br>
<?php
/*
	code sample, generator format 2  
	in this format the options DONT have value property like
		<option>option text</option>
		
	this example show how such PSPL Multi Select Boxes can be created using
	the PSPLMultiselect class in PHP
*/
	//define the options => option text pairs for select box
	$weekdays = array( "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday");
	
	//define array of selected options
	$selecteddays = array("Monday", "Thursday" );
	
	//print the multiselect
	// not the LAST option is NO for this format
	$selectGenerator->PrintMultiSelect( "weekdays", $sampleOptions1, $selectedOptions1, "NO" );

?>
<br>

<?php

	/*
		similarly you can define generator for any style
		and that generator can create any number of boxes of that style
		
		so for style 2 we can define like
	*/
	
	$selectGenerator = new PSPLMultiSelect( "arrow_on2.gif", "arrow_off2.gif","arrow2", "optionTextBox2", "optionDiv2", "cell2", "cellHover2", "cellSelected2", "selBox2" );				

	/*
	code sample, generator format 2  
	in this format the options DONT have value property like
		<option>option text</option>
		
	this example show how such PSPL Multi Select Boxes can be created using
	the PSPLMultiselect class in PHP
*/
	//define the options => option text pairs for select box
	$sample2 = array( "PHP", "Generator", "PSPL", "Multi Select box", "W3c Compliant", "Cross Browser stable", "Easy customization");
	
	//define array of selected options
	// nothing selected
	$selected2 = array();
	
	//print the multiselect
	// not the LAST option is NO for this format
	$selectGenerator->PrintMultiSelect( "pspl_sample", $sample2, $selected2, "NO" );

?>
</body>

</html>
Return current item: PSPLMultiselect