0

i am doing select the data that you want ,then it will search the data in another drop-down list then to search the result~ but it cannot work ,,,can help me

<option value="0">-SELECT PROGRAM-</option>
          <?php require_once('../../../Connections/admin_db.php');
    

            $q = "SELECT p_id,p_name FROM p_reg ORDER BY p_id asc" ;
            $res = mysql_query($q) ;
                                                        
           if (mysql_num_rows($res) == 0) echo "<option>Please Register Level</option>" ;
                                                        
                  while($row = mysql_fetch_array($res))
                      {
                         $p_id = $row['p_id'] ;
                         $p_name = $row['p_name'] ;
                                                            
        if($_REQUEST['prog'] == $p_id) echo "<option selected value='$p_id'>$p_id - $p_name</option>" ;
            else echo "<option value='$p_id'>$p_id - $p_name</option>" ;
             }	
						?>
                    <?
             
if ($_REQUEST['Submit'] && $_REQUEST['prog'] != "0")
					{
	$p_id = $_REQUEST['prog'] ;
				?>
         </select></td>
                <td width="12%" align="right"><strong>COURSE :</strong></td>
		<td width="39%" align="left">               
<select name="course" id="course" onChange="location = 'test.php?Submit=Program&amp;Submit2=Course&amp;prog=<? echo $p_id ?>&amp;course=' + this.options[this.selectedIndex ].value;">
  <option value="0">-SELECT COURSE-</option>
						
	<?php
	$q = "SELECT c_id,c_name FROM c_register WHERE p_id='$p_id' ORDER BY c_id asc" ;
         $res = mysql_query($q) ;
																						       if (mysql_num_rows($res) == 0) echo "<option>Please Register Level</option>" ;
											while($row = mysql_fetch_array($res))
{
$c_id = $row['c_id'] ;
$c_name = $row['c_name'] ;
																					if($_REQUEST['course'] == $c_id) echo "<option selected value='$c_id'>$c_id - $c_name</option>" ;
else echo "<option value='$c_id'>$c_id - $c_name</option>" ;
		}														
	?>
	</select></td>
                <?
}?>

Edited by ss90: n/a

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by jkon
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.