Location: PHPKode > scripts > Cascade Select Associative > cascade-select-associative/csa_example.php
<? include("cascadeSelectAssoc.php"); ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Cascade Select Example</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style>
	select{
		width:50%;
	}
</style>
</head>
<body>
<h2>Using cascadeSelectAssoc (A Simple Example) </h2>
<?
// data for cascade select
$motherArray = array('1'=>'Food',2=>'Drinks', 3=>'Fruits', 4=>'Veg');

$childArray = array(
     "1"  => array(
		"1"  => "Ham",
		"2" => "Burger",
		"3" => "Pizza",
		"4" => "Burrito"
     ),
     "2"  => array(
          "1"  => "Beer",
          "2"  => "Soda",
          "3"  => "Coke",
          "2"  => "Tequila"
     ),
     "3"  => array(
          "1"  => "Banana",
          "2"  => "Apple",
		  "3"  => "Mango",
		  "4"  => "Pineapple"
     ),
     "4"  => array(
          "1"  => "Tapioca",
          "2"  => "Cabbage",
		  "3"  => "Brocoli",
		  "4"  => "Onion",
		  "5"  => "Potato"
	)
);

$o=new cascadeSelectAssoc("testForm");
$o->setName("select1","select2");
$o->setHeight(1,1);
$o->setData($motherArray,$childArray);
$o->writeScript();
?>
<form name="testForm" method="post">
<?
$o->drawMother();
$o->drawChild();
?>
<br>
<input type="submit" value="GO">
</form>
</body>
</html>
Return current item: Cascade Select Associative