Advertisement
Guest User

Untitled

a guest
May 20th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.86 KB | None | 0 0
  1. <html>
  2. <head>
  3. <?php
  4.     $lettera = $_POST["lettera"];
  5.     if(isset($lettera)){
  6.         include("connettoreDB.php");
  7.         $lettera = strtoupper($lettera);
  8.         $query = "SELECT CONCAT(s.Nome,' ',s.Cognome) as nominativo FROM `Studenti` as s, `Voti` as v WHERE s.Cognome LIKE '".$lettera."%' AND s.ID = v.ID_Studente AND v.Voto > 6 GROUP BY s.Cognome";
  9.         $result = mysqli_query($link, $query);
  10.         while($row = mysqli_fetch_array($result)){
  11.             print($row["nominativo"]);
  12.             print("<br>");
  13.         }
  14.     }
  15. ?>
  16. </head>
  17. <body>
  18. <form name = "f1" method = "POST" action = "">
  19. <select name = "lettera">
  20. <?php
  21.     // dal 65 al 90
  22.     for($c = 65; $c <= 90; $c++){
  23.         print("<option value='".strtolower(chr($c))."'>".chr($c)."</option>");
  24.     }
  25. ?>
  26. </select>
  27. <input type = "submit" value = "invio">
  28. </form>
  29. </body>
  30. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement