PHP Classes

File: example_2.php

Recommend this page to a friend!
  Classes of Panos Kyriakakis  >  AJAXed list boxes  >  example_2.php  >  Download  
File: example_2.php
Role: Example script
Content type: text/plain
Description: Example for new extra where feature
Class: AJAXed list boxes
Generate AJAXed linked select inputs
Author: By
Last change: Demonstrates new custom 'Please select' option.
Date: 15 years ago
Size: 3,072 bytes


Class file image Download

('Content-Type: text/html; charset=iso-8859-1');
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Expires: Thu, 19 Nov 1981 08:52:00 GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0?, false');
header('Pragma: no-cache');


            <title> - Linked selected boxes demo page</title>
            <META NAME="author" CONTENT="Panos Kyriakakis">
            <meta name="description" lang="en" content="Demo page. Linked selected boxes that load items from database using AJAX">
            <meta name="keywords" lang="en" content="Demo page, Linked selected boxes, Content management, Components and tools to manage content, AJAX, Interact with the Web server without page reloading">
            <META name="verify-v1" content="2CKKXxDtxsHjE7TjmXjWJSzMj5xqXOvTrnZ27goGJSE=" />
            <META name="robots" content="follow,index" />
            <link href="" rel="stylesheet" type="text/css"></link>
        <script src="prototype.js" type="text/javascript"></script>
        <h2><a href=""> - Ajax Linked Select boxes Demo 2</a></h2>
        Now all data are on the same table.
        CREATE TABLE lsd_demo_2 (
          rec_id int(11) NOT NULL auto_increment,
          parent_id int(11) NOT NULL default '0',
          descr varchar(50) collate latin1_bin NOT NULL default '',
          PRIMARY KEY (rec_id)
        ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_bin;
        Items for first (parent) select box parent_id=0.
        Using the new parameter to set an extra field in where clause parent items are filtered.
$sc_ajax_select_boxes = new sc_ajax_select_boxes();
$sc_ajax_select_boxes->add_select_box('lsd_demo_2','rec_id','descr','rec_id',2,'sel1','sel_id_1','', 'parent_id=0','Select 1');
$sc_ajax_select_boxes->add_select_box('lsd_demo_2','rec_id','descr','rec_id',11,'sel2','sel_id_2','','','Select 2');
$sc_ajax_select_boxes->add_select_box('lsd_demo_2','rec_id','descr','rec_id',43,'sel3','sel_id_3','','','Select 3');
$sc_ajax_select_boxes->link_select_boxes('sel1','sel2', 'parent_id',2);
$sc_ajax_select_boxes->link_select_boxes('sel2','sel3', 'parent_id',10);
<form name="main" method="POST" action="example_2_posted.php">
<input type="submit" value="POST" />

For more information send a message to info at phpclasses dot org.