HTML Select Boxes not displaying

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Everyone,

I have encountered a problem with IE that I am unsure how to get around.
I dynamically create quite a few drop down boxes to enable categories to 
be oredered. It works fine for me (XP box) however everyone else in my 
office is running ME or 98 and it doesnt work in IE for any of them. 
Works fine in Netscape and Mozilla. Both myself and my boss are running 
IE6, same build, however he is ME and I'm XP, and he cant see them either.

Below is the code I'm using....any help with this would be great.

Thanks in advance,
Nigel Dunn

<?
// includes the db connection, etc
include("../config/global.inc");

function display_ordered_list() {
	
   echo "<table width='600' border='0' cellpadding='2' cellspacing='0'>";
   echo "<tr><td><b>Category Name</b></td><td align='right'><b>Category 
Order<b></td></tr>";
   $result = mysql_query("SELECT * FROM category WHERE parent_id = '0' 
ORDER BY list_id, name");
   $num_rows = mysql_num_rows($result);
   if ($row = mysql_fetch_array($result)) {
     do {
       $cat_id = $row['id'];
       $name = $row['name'];
       $list_id = $row['list_id'];
       echo "<tr><td>$name</td><td align='right'><select 
name='cat[$cat_id]'>\n";
       echo select_list($list_id, $num_rows);
       echo "\n</select></td></tr>\n";			
	
       $result2 = mysql_query("SELECT * FROM category WHERE parent_id = 
'$cat_id' ORDER BY list_id, name");
       $num_rows2 = mysql_num_rows($result2);
       if ($num_rows2 != 0) {
         // echo "<tr><td colspan='2'><hr></td></tr>";
         echo "<tr><td>&nbsp;</td><td>\n\n";
         echo "<table width='85%' border='0' cellpadding='2' 
cellspacing='0'>\n";
         echo "<tr><td><b>Sub-Category Name</b></td><td 
align='right'><b>Sub Category Order</b></td></tr>\n";
         if ($row2 = mysql_fetch_array($result2)) {
           do {
             $sub_id = $row2['id'];
             $sub_name = $row2['name'];
             $sub_list_id = $row2['list_id'];
             echo "<tr><td>$sub_name</td><td align='right'><select 
name='cat[$sub_id]'>\n";
             echo select_list($sub_list_id, $num_rows2);
             echo "</select></td></tr>\n";
           } while ($row2 = mysql_fetch_array($result2));
         }
         echo "\n</table>\n";
         echo "</td></tr>\n";
         echo "<tr><td colspan='2'><hr></td></tr>\n";
       }
     } while ($row = mysql_fetch_array($result));
   }
   echo "<tr><td colspan='2'><hr></td></tr>\n";
   echo "<tr><td>&nbsp;</td><td><input type='submit' name='Submit' 
value='Submit'></td></tr>\n";
   echo "</table>\n";
}

function select_list($id, $total) {

   for ($x = 1; $x <= $total; $x++) {
     if ($x == $id) {
       $option_list .= "<option value='$x' selected>$x</option>\n";
     } else {
       $option_list .= "<option value='$x'>$x</option>\n";
     }
   }
   return $option_list;
}

?>
<html>
<head>
<title>Order Categories Test</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<form action='<?= $PHP_SELF; ?>' method='POST'>
		
<?
if ($Submit == "Submit") {

   $the_end = false;
   $s = reset($cat);
   $k = key($cat);
   $c = count($cat);
	
   while(!$the_end) {
     for($i = 0; $i < $c; $i++) {
       $result = mysql_query("UPDATE category SET list_id = '" . 
$cat[$k] . "' WHERE id = '$k'");
       $s = next($cat);
       if ($s==false) {
         $the_end=true;
       } else {
         $k = key($cat);
       }
     }
   }
}

display_ordered_list();

?>
   </form>
</body>
</html>


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux