Facebook
From Justii1311, 1 Year ago, written in HTML5.
Embed
Download Paste or View Raw
Hits: 223
  1. <?
  2. session_start();
  3.  
  4.         require_once "connect2.php";
  5.         $conn = new mysqli($host, $db_user, $db_password, $db_name);
  6. $conn->query("SET NAMES 'utf8' COLLATE 'utf8_polish_ci'");
  7.  
  8.    $zaleznosci = "SELECT name FROM cities WHERE id = '".$_GET['id']."'";   //mam tutaj nazwe miasta ktore wybralam w select
  9.         $rezultat = $conn->query($zaleznosci);
  10.    
  11. ?>
  12.  
  13.  
  14. <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
  15.            <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
  16.            
  17.         <script type="text/javascript">
  18.         $(document).ready(function() {
  19.   $(".clinic-select").select2({
  20.                 width: '100%',
  21.   });
  22. });
  23.         </script>
  24.   <script src="js/jquery2.js"></script>
  25.  
  26.  
  27.         <link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/css/select2.min.css" rel="stylesheet" />
  28.         <script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/js/select2.min.js"></script>
  29.        
  30. </head>
  31.        
  32. <select  class="clinic-select"  multiple="multiple"  name='clinics[]' onchange="selectAnimalClinics(this);"  name="animal_clinic" id="subcategoriesCity-select">
  33.                 <?php
  34.                 $rows=$rezultat->num_rows;
  35.                 while($rows>0){
  36.                 $key = $rezultat->fetch_assoc();               
  37.                 $udasie= "SELECT id,name FROM animal_clinics WHERE city = '".$key[name]."' ";
  38.                         $rezultat3 = $conn->query($udasie);
  39.                         $rows2=$rezultat3->num_rows;
  40. while($rows2>0){
  41.         $wiersz= $rezultat3->fetch_assoc();
  42.         echo '<option value=' . $wiersz[id] . '>' . $wiersz[name] . $rows . '</option>';
  43.                 $rows2--;
  44. }
  45.                 $rows--;
  46.                 }
  47.                 ?>
  48.  
  49.         </body>
  50.