PHP Classes

File: exampleARRAY.php

Recommend this page to a friend!
  Classes of Javier Gonzalo Gloria Medina   Drop Down Select   exampleARRAY.php   Download  
File: exampleARRAY.php
Role: Example script
Content type: text/plain
Description: How To Use DropDown <select> with an Array
Class: Drop Down Select
Generate HTML for drop down form select inputs
Author: By
Last change:
Date: 19 years ago
Size: 980 bytes
 

Contents

Class file image Download
<?PHP
include("Drop_Down.class.php");
//create and array with the following format Indexes, Value
$assessment_type = array("1" => "Option 1", "2" => "Option 2");
//Create a new object of DropDown();
$typedrop_down = &new DropDown();
//SEt the name of the <select> in this case this will be <select name="bnames">
$typedrop_down->Dd_name = "Astype";////default its select
//Set params to the select like javascript or styles
//$typedrop_down->Params = "onchange='javascript: switchSec(document.frmAnalysis.Astype[document.frmAnalysis.Astype.selectedIndex].value);'";//optional
//Set the name of the first option that will apear in thi case <select name="Astype"><option>Select Something<option>
$typedrop_down->Dd_select_option = "Select Something";
//Set the value to select
//$typedrop_down->Cache_value = $cached_value;//optional
//Send the array and method to the class
$output = $typedrop_down->Dd_src($assessment_type,"AR");
//print result.
echo $output;
?>