0

i have a dopdown menu which shows the list of tables in the database..now i want to dispaly the result of the selected table from the database in the dropdown menu on submit but i am unable to get how to do it,kindly help..

<?
    $link= mysql_connect("localhost","root","") or die ("could not connect");
    mysql_select_db("creative design") or die("could not Select database");

     $sql = "SHOW TABLES";
     $result = mysql_query($sql);
     $tableNames= array();

     while ($row = mysql_fetch_row($result)) {
      $tableNames[] = $row[0];
      }
      ?>

      <? echo '<select name="tables" id="tables">';     
     foreach ($tableNames as $name){
     echo '<option value="' . $name . '">' . $name . '</option>';
     }
     echo '</select>';
     ?>
     <input  name="sbtn" type="submit" value="update" />

Edited by sehrish naimat

2
Contributors
2
Replies
12
Views
3 Years
Discussion Span
Last Post by sehrish naimat
0

Your code words for me.. maybe because you have a space in your database name. Can you post the full form script. So we can see what you are doing in the form.

0

i have removed the space from the database name.its working alright with or witout space in the database name.the options in the dropdown menu are the table names of my database "creative design".the tables of my database contains images.i want it like when i select any one of the option in the dropdown menu the images in the selected table are displayed.bt i am unable to code for it..this is the only i have done yet.kindly help me out..

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.