Salix.gr - Ajax Linked Select boxes Demo 7

Usage of radio buttons. 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.

Please Select





Please Select







            <?php
        	include("top_script.php");    
            include("sc_classes.php");
            
            $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');
            $sc_ajax_select_boxes->add_radio_box('lsd_demo_2','rec_id','descr','rec_id',10,'sel2','sel_id_2','');
            $sc_ajax_select_boxes->add_radio_box('lsd_demo_2','rec_id','descr','rec_id',43,'sel3','sel_id_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);
            $sc_ajax_select_boxes->place_jscripts();
            ?>
            <?form name="main" method="POST" action="example_2_posted.php">
                <?php
                $sc_ajax_select_boxes->show_select_box('sel1');
                $sc_ajax_select_boxes->show_select_box('sel2');
                $sc_ajax_select_boxes->show_select_box('sel3');
                ?>
                <input type="submit" value="POST" />
            </form>