PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Javier Gonzalo Gloria Medina   Drop Down Select   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: How to Use DropDown <select> with SQL and ADODB´s CACHE
Class: Drop Down Select
Generate HTML for drop down form select inputs
Author: By
Last change: //update include("Drop_Down.class.php");
Date: 19 years ago
Size: 1,542 bytes
 

Contents

Class file image Download
<?PHP
//include class
include("Drop_Down.class.php");
//This example use SQL and ADODB´s CACHE feature.
//SQL query to run
$sqlbiz = "SQL to run";
//Create a new object of DropDown();
$drop_bnames = &new DropDown();
//SEt the name of the <select> in this case this will be <select name="bnames">
$drop_bnames->Dd_name = "bnames";//default its select
//Set params to the select like javascript or styles in this case we are using a javascript to catch the text of the option to a hidden
//input. so dont use it or you will get and error. in case you want to use it just create the hidden input with name biz_name.
//$drop_bnames->Params = "onchange='javascript: //document.frmAnalysis.biz_name.value=document.frmAnalysis.bnames[document.frmAnalysis.bnames.selectedIndex].text;'";
//Set the name of the first option that will apear in thi case <select name="bnames"><option>Select A Business Name<option>
$drop_bnames->Dd_select_option = "Select something";//defalutl its Select an Option
//Set the value to select
$drop_bnames->Cache_value = $_POST['bnames'];//optional
//Set the time of the cache before reloading it from the SQL.
$drop_bnames->Cache_time = 1800;//default its 900 secs optional and only used with CACHESQL method
//Send the sql and method to the class
$select = $drop_bnames->Dd_src($sqlbiz,"CACHESQL"); //if your using this feature you can set the full path fo the cache directory inside //the class or call the variable $drop_banmes->Cache_dir = "/path/to/cache/dir/";
//output.
echo $select;
?>