Home  • University • Campus
The following code has a problem- when i execute this file a notice show in catagory box like this (undefined
index cat_id) but when i select one then output is done . Please find out this problem. <script language="javascript"
type="text/javascript"> function showCompany(cat_id) { document.frm.submit(); } </script> <?php include('db.php'); ?> <form action="" method="post"
name="frm" id="frm"> Category box<select name="cat_id"
id="cat_id" onChange="showCompany(this.value);"> <option value="">--Select--</option> <?php $rs=$db->query("select * from category"); while($row1=$rs->fetch_array()){ ?> <option value="<?php echo $row1[0]; ?>" <?php
if($row1[0]==$_REQUEST['cat_id']){ echo "Selected"; } ?>
><?php echo $row1[1]; ?></option> <?php } ?> </select><br/> Category value_box <select name="company_id"
id="company_id"> <option value="">--Select--</option> <?php $rs1=$db->query("select * from company where
cat_id='$_REQUEST[cat_id]'"); while($row=$rs1->fetch_array()){ ?> <option value="<?php echo $row[0];
?>"><?php echo $row[2]; ?></option> <?php } ?> </select> </form>

Comments 10


About Author
Jakir Hosan Zilon
Copyright © 2026. Powered by Intellect Software Ltd