Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_php thread: listboxes on the fly..


Message #1 by guru@i... on Thu, 19 Jul 2001 00:01:01
Elliot,
The following example uses phplib oohforms.

****************************************************************************
*****************************************
<html>
    <head>
        <title>Choose Tray Segment</title>
    </head>
	<body text="#000000" background="../images/ELN-watermark.gif"
link="#0000FF" vlink="#800080">
    <?php
     print "<H3 align=\"center\">NE-5436 Test Project</H3>";
     print "<H1 align=\"center\">Choose Tray Segment</H1>";
    /* Created by Bob White June 12, 2001 */
    $f = new form;
    $db = new ieweb_DB;
/***************************************************************************
****/  
    
$trays = "SELECT device.name_txt name,device.device_unique_no uni from ".
         "DEVICE, ELEC_EQUIP where ".         
         "device.device_unique_no = elec_equip.fk_device_unique_no and ".
         "device.device_type_id = 332 and elec_equip.segment_type_id = 3 ".
         "ORDER BY name asc";
$list_of_trays[0] = array("label"=>'None Available',"value"=>'0');
if($db->query($trays)){ $counter = 0;      
/*if($db->num_rows() <> 0){$counter = 0;*/
    while ($db->next_record()){
       $list_of_trays[$counter++] 
array("label"=>$db->f('name'),"value"=>$db->f('uni'));
    }
}
else{
       $list_of_trays[0] = array("label"=>'None Available',"value"=>'0');
} 
$f->add_element ( array("type"=>"select",
		        "name"=>"tray_no",
	                "options"=>$list_of_trays,
	                "size"=>"10",
	                "value"=>$list_of_trays[0]));
	                
/***************************************************************************
****/

$f->start($not,"GET","../first_show_tray_cables.php","_self");
print "<PRE>";
echo "Tray No";echo "<BR>";
$f->show_element('cable_list');$f->show_element('tray_no');echo "<BR>";
print "</PRE>";
echo "<BR>";
echo "<BR>";
echo "<input type=submit value=\"Continue\">";
echo "<BR>";
$f->finish();
echo "<BR>";
print "<a href=\"start.html\">Home</a>";
print "<BR>";
?>
</body>
</html>
****************************************************************************
******************************************


Bob White




  Return to Index