PHP Classes

File: exampleSQL.php

Recommend this page to a friend!
  Classes of Javier Gonzalo Gloria Medina  >  Drop Down Select  >  exampleSQL.php  >  Download  
File: exampleSQL.php
Role: Example script
Content type: text/plain
Description: How To DropDown <select> with SQL (MySQL)
Class: Drop Down Select
Generate HTML for drop down form select inputs
Author: By
Last change:
Date: 12 years ago
Size: 1,163 bytes


Class file image Download
//This example use SQL
//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
//Send the sql and method to the class
$select = $drop_bnames->Dd_src($sqlbiz,"SQL");
echo $select;