problems on dynamic dropdown lists

Salvador Mark Anjelo

I am currently working on a a drop down list which fetch all college names in my college table I was wondering how can I make a another drop down list in which it fetches all departments in the currently selected collage name without using a form (for the page must not reload during the process.

There are two tables involved one is for the departments and other is for college

this is a sample code from the first drop down list.

<tr>
<th class="text-success">College:</th>
  <td>
    <select name = "AdminUpdateCollageID" class ="bg-info" name>
    <option>Please choose a college </option> 
    <option>
      <?php
         $sql = mysql_query("SELECT * FROM colleges")
         or die("NO table selected" . mysql_error());
         while($rw = mysql_fetch_array($sql)){ 
         echo $rw['College_Name'] ; //this displays the values in the dropdown

                         }
?> 
 </option></select>  

 </td> 
 </tr>

I'l Try to upload the two tables this is the first time I post a question on stackoverflow also I am still a student please bear with me any help will be very appreciated.

Yair.R

Because you are a student, I won't give you a directly answer - I'll give you sources which you will need to read and get the solutions by yourself:

  1. JQUERY - http://www.jquery.com
  2. AJAX - http://api.jquery.com/jquery.ajax/

A BONUS TO FIX PHP:

  1. PDO - http://wiki.hashphp.org/PDO_Tutorial_for_MySQL_Developers
  2. http://www.phptherightway.com

Good luck :)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related