Today's Posts Follow Us On Twitter! TFL Members on Twitter  
Forum search: Advanced Search  
Navigation
Marketplace
  Members Login:
Lost password?
  Forum Statistics:
Forum Members: 24,254
Total Threads: 80,792
Total Posts: 566,471
There are 1077 users currently browsing (tf).
 
  Our Partners:
 
  TalkFreelance     Design and Development     Programming     Javascript :

dynamic dropdown <select>

Thread title: dynamic dropdown <select>
Closed Thread    
    Thread tools Search this thread Display Modes  
09-09-2007, 08:51 PM
#1
pixelgod is offline pixelgod
Status: Member
Join date: Jul 2007
Location: 127.0.0.1
Expertise:
Software:
 
Posts: 110
iTrader: 4 / 100%
 

pixelgod is on a distinguished road

Send a message via MSN to pixelgod

  Old  dynamic dropdown <select>

Well, I need some more help TFL,
This is what I need, I need to have the second drop down refresh depending on the users choice from the first one. This sounds like basic javascript, but I then need the second drop down to get it's options from a MySQL database.

Here's my code so far:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>test</title>
</head>

<body>
  <?php if($_GET['page'] == NULL) { echo"
  <div class=\"form\">
  <p>Delete template</p>
  <form id=\"form4\" name=\"form4\" method=\"post\" action=\"\">
<label>Category ";
	$sql = "SHOW TABLES LIKE 'CMS_%'";
    $query = mysql_query($sql);
    
    $rows = array();
	if(mysql_num_rows($query) > 0){
	    while($row = mysql_fetch_array($query)) {
    	    array_push($rows, substr($row[0], 4));
	    }
	}
    if (count($rows) == 0) {
        echo 'No tables in the database found beginning with <strong>cms_</strong>...<br />';
    } else {
	   echo '<select name="deletetem1">';
       if(is_array($rows)){
	      foreach($rows as $value){
	         echo '<option>'.$value.'</option>';
	      }
	      echo '</select>';
	   } else {
	      echo "$rows is not an array";
	   }
    } 
	 echo"
    </label>
    <p>
      <select name="">
      
	  <!-- I need this drop down to get it's selections from the row "coolbeans" from the table selected above.-->
	  
	  </select>
</p>
    <p>
      <label>
      <input type=\"submit\" name=\"removecoolbeansub\" value=\"Delete\" />
      </label>
    </p>
  </form>
  </div>"; } ?>

</body>
</html>

Closed Thread    


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

  Posting Rules  
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump:
 
  Contains New Posts Forum Contains New Posts   Contains No New Posts Forum Contains No New Posts   A Closed Forum Forum is Closed