Advertisement
Guest User

Untitled

a guest
Feb 28th, 2013
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.52 KB | None | 0 0
  1. // HTML ---------------------------
  2. <select id="first">
  3. ...
  4. </select>
  5.  
  6. <select id="second"></select>
  7.  
  8. <script>
  9.     $('#first').select(function(){
  10.         firstValueSelected = $(this).attr('value');
  11.         $.get('yoursite.com/getSecond',{idFirst: firstValueSelected},function(data){
  12.             $('#second').append(data);
  13.         });
  14.     });
  15. </script>
  16.  
  17. // PHP -----------------------------
  18.  
  19. function getSecond(){
  20.     $id = $_GET['idFirst'];
  21.  
  22.     ///sql and foreach goes here
  23.         $values = "<option>".$row['any']."</option>";
  24.     /// end
  25.     echo $values;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement