Login   Register  
PHP Classes
elePHPant
Icontem

File: csa_example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Roberto Andrade Fonseca  >  Cascade Select Associative  >  csa_example.php  >  Download  
File: csa_example.php
Role: Example script
Content type: text/plain
Description: Simple example with associative arrays
Class: Cascade Select Associative
Generate two dependent HTML form select inputs
Author: By
Last change:
Date: 9 years ago
Size: 1,371 bytes
 

Contents

Class file image Download
<? 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>