开发者

dynamic form with php and javascript

I want to create a dynamically changing form, when someone select first option, it makes query on mysql and change secont option automatically based on first.

I don't know how to make things in java so I found it. I found tutorial like this manual

but problem is, it's not working in block

   $query = "se开发者_JAVA技巧lect * from tbl_class";  
     $result = mysql_query($query) or die("Error in Query! ".mysql_error());  

     while($row = mysql_fetch_array( $result ))  
     {  
      echo "<option "'="" .="" id']="" value="" . $row[">" . $row['name'] . " </option>";  
     }  

in row echo option... is error syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' Can you help me please ? :(


there is something wrong in line 6:

 $query = "select * from tbl_class";  
 $result = mysql_query($query) or die("Error in Query! ".mysql_error());  

 echo '<select id="secondSelect">';
 while($row = mysql_fetch_array( $result ))  
 {  
  echo '<option value="'.$row["id"].'">'.$row["name"].'</option>';
 }  
 echo '</select>';
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜