Advertisement
Guest User

Untitled

a guest
Jul 5th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1. <html>
  2. <body>
  3. <script language="javascript" type="text/javascript">
  4. <!--
  5. function ajaxFunction(){
  6. var ajaxRequest;
  7.  
  8. try{
  9. ajaxRequest = new XMLHttpRequest();
  10. } catch (e){
  11. alert("Not Supported!");
  12. return false;
  13. }
  14. ajaxRequest.onreadystatechange = function(){
  15. if(ajaxRequest.readyState == 4){
  16. var ajaxDisplay = document.getElementById('ajaxDiv');
  17. ajaxDisplay.innerHTML = ajaxRequest.responseText;
  18. }
  19. }
  20. var nick = document.getElementById('nick').value;
  21. var queryString = "?nick=" + nick;
  22. ajaxRequest.open("GET", "filter.php" + queryString, true);
  23. ajaxRequest.send(null);
  24. }
  25.  
  26. //-->
  27. </script>
  28.  
  29. <form name='myForm'>Nick: <select id='nick' onchange='ajaxFunction()' />
  30. <option value='all'>All</option>
  31. <?
  32. $dbserver = "localhost";
  33. $dbuser = "xxxxx";
  34. $dbpassword = "xxxxx";
  35. $db = "goodtimes";
  36.  
  37. mysql_connect($dbserver,$dbuser,$dbpassword);
  38. @mysql_select_db($db) or die("Unable to connect to database");
  39.  
  40. $query = "SELECT DISTINCT name FROM urls WHERE channel='#Goodtimes' order by name asc";
  41. $result = mysql_query($query);
  42. $num = mysql_numrows($result);
  43. mysql_close();
  44. $i = 0;
  45. while ($i < $num) {
  46. $nick = mysql_result($result,$i,"name");
  47. echo "<option value='$nick'>$nick</option>";
  48. $i++;
  49. }
  50. ?>
  51. </select>
  52.  
  53. <div id='ajaxDiv'></div>
  54. </form>
  55. </body>
  56. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement