Advertisement
Guest User

Untitled

a guest
Dec 14th, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
  5. <link href="bdlab.css" rel="stylesheet" type="text/css"/>
  6. <title>Utilizzo della variabile $_GET</title>
  7. </head>
  8.  
  9. <body>
  10. <h2>Utilizzo della variabile $_GET</h2>
  11. <pre>
  12. <?php
  13. //print_r($_GET);
  14. $ricette_puglia=Array(
  15. "Cartellate pugliesi ricetta",
  16. "Panzerotti fritti pugliesi",
  17. "Vincotto di fichi secchi",
  18. "Zucchine ripiene di tonno");
  19.  
  20. $ricette_liguria=Array(
  21. "Torta di carciofi",
  22. "Salsa verde",
  23. "Focaccia genovese");
  24.  
  25. $ricette=Array();
  26. $ricette["Puglia"]=$ricette_puglia;
  27. $ricette["Liguria"]=$ricette_liguria;
  28. ?>
  29. </pre>
  30.  
  31. <div>
  32. Ricette originali della regione
  33. <?php
  34. print($_GET["regione"]);
  35. ?>
  36. </div>
  37.  
  38. <?php
  39. $ricette_param=$_GET["regione"];
  40. $ricetta_list=$ricette[$ricette_param];
  41. //Posso sostituire le 2 righe sopra con la seguente:
  42. //$ricetta_list=$ricette[$_GET["regione"]];
  43. foreach($ricetta_list as $ricetta){
  44. print("<div>");
  45. print($ricetta);
  46. print("</div>");
  47. }
  48. ?>
  49. </body>
  50. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement