Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2019
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.83 KB | None | 0 0
  1. <!doctype html><html>
  2. <head>
  3. <meta charset="utf-8">
  4. </head>
  5. <body style="background-color:#ffcc66;">
  6. <div style="background-color:#734d00; width:50%; height:100px; float:left; text-align:center; color:white; font-size:500%;">
  7. NEWSY
  8. </div>
  9. <div style="float:left; width:25%; height:100px; background-color:#734d00; color:white;">
  10. <h3>Wybierz datę z kalendarza:</h3>
  11. <form method="post" action="">
  12. <input type="date" name="data"/>
  13. <input type="submit"/>
  14. </form>
  15. </div>
  16. <div style="float:left; width:25%; height:100px; background-color:#734d00; color:white;">
  17. <center>
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26. <h3>Wybierz datę z istniejących:</h3>
  27. <form method="post" action="">
  28. <select name="data">
  29. <option value="pokazwszystkie">Pokaż wszystkie</option>
  30. <?php
  31. $polaczenie=mysqli_connect('localhost','root','','news_agata');
  32. mysqli_set_charset($polaczenie,"utf8");
  33. $wynik1=mysqli_query($polaczenie,'select data from tytul group by data desc;');
  34. while ($wiersz=mysqli_fetch_array($wynik1))
  35. {
  36. echo '<option value="'.$wiersz['data'].'">'.$wiersz['data'].'</option>';
  37. }
  38. echo '</select>';
  39. echo '<input type="submit"/>';
  40. echo '</form>';
  41. echo '</center>';
  42. echo '</div>';
  43. echo '<div style="clear:both; background-color:#cc9933; width:95%; padding:2.5%;">';
  44. function funkcja()
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56. {
  57. $polaczenie=mysqli_connect('localhost','root','','news_agata');
  58. mysqli_set_charset($polaczenie,"utf8");
  59. $wynik1=mysqli_query($polaczenie,'select data from tytul group by data desc;');
  60. @$wybranadata=$_POST['data'];
  61. if ($wybranadata=="pokazwszystkie")
  62. {
  63. $wynik2=mysqli_query($polaczenie,'select tytul, tresc, autor, data from tytul,tresc where tytul.id_news=tresc.id_news order by data desc;');
  64. while ($wiersz=mysqli_fetch_array($wynik2))
  65. {
  66. echo '<h1>'.$wiersz['tytul'].'</h1>';
  67. echo '<p>'.$wiersz['tresc'].'</p>';
  68. echo '<h6> Autor: '.$wiersz['autor'].'</h6>';
  69. echo '<h6> Data: '.$wiersz['data'].'</h6></br></br>';
  70. }
  71. }
  72. else
  73. {
  74. $wynik2=mysqli_query($polaczenie,'select tytul, tresc, autor, data from tytul,tresc where tytul.id_news=tresc.id_news and data="'.$wybranadata.'" order by data desc;');
  75. while ($wiersz=mysqli_fetch_array($wynik2))
  76. {
  77. echo '<h1>'.$wiersz['tytul'].'</h1>';
  78. echo '<p>'.$wiersz['tresc'].'</p>';
  79. echo '<h6> Autor: '.$wiersz['autor'].'</h6>';
  80. echo '<h6> Data: '.$wiersz['data'].'</h6></br></br>';
  81. }
  82. }
  83. }
  84. if (funkcja()==null)
  85. {
  86. echo "Żaden news nie pasuje do wybranej daty.";
  87. }
  88. ?>
  89. </div>
  90. <div style="background-color:#734d00; width:100%; text-align:center; color:white;">
  91. Autor strony: Agata Prażmo
  92. </div>
  93. </body>
  94. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement