Advertisement
Guest User

Untitled

a guest
Jul 11th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.85 KB | None | 0 0
  1. <html>
  2. <head>
  3. <title>Haagse Hogeschool</title>
  4. <link rel="stylesheet" href="style.css" type="text/css" media="screen" />
  5. </head>
  6. <body>
  7. <div id="container">
  8. <div id="header">
  9. <img src="images/header.jpg" />
  10. </div>
  11. <div id="menu-links">
  12. <ul>
  13. <li><a href="" class="menu-link">Link 1</a></li>
  14. <li><a href="" class="menu-link">Link 2</a></li>
  15. </ul>
  16. </div>
  17. <div id="content">
  18.  
  19. <form name="search" method="post" action="zoek.php">
  20. Zoek naar: <input type="text" name="find" /> in
  21. <Select NAME="field">
  22. <Option VALUE="studentnummer">Studentnummer</option>
  23. <Option VALUE="voornaam">Voornaam</option>
  24. <Option VALUE="achternaam">Achternaam</option>
  25. <Option VALUE="slb">Slb-er</option>
  26. </Select>
  27.  
  28. <input type="hidden" name="searching" value="yes" />
  29. <input type="submit" name="zoek" value="Zoek"/><br />
  30. <center><a href ="allesweergeven.php" method="get" action="allesweergeven.php">alles weergeven</a></center>
  31. </form>
  32.  
  33. <?php
  34. /************************************
  35. * verbinding maken met de database *
  36. * *
  37. ************************************/
  38.  
  39. $server = "localhost";
  40. $username = "root";
  41. $password = "";
  42. mysql_connect($server, $username, $password) or die(mysql_error());
  43. $dbname = "hogeschool";
  44. mysql_select_db($dbname) or die(mysql_error());
  45. $tbl_name="student";
  46.  
  47. if ($find == "" && $searching)
  48. {
  49. echo "Voer uw zoekopdracht in";
  50. exit;
  51. }
  52. if ($find != ""){
  53. $gezochtNaar = $find;
  54. $find = strtoupper($find);
  55. $find = strip_tags($find);
  56. $find = trim ($find);
  57.  
  58. $find = "WHERE upper(".$field.") LIKE '%".$find."%'";
  59.  
  60. } else {
  61. $find = "";
  62. }
  63.  
  64. $zoekresult = mysql_query("SELECT * FROM student ".$find);
  65.  
  66. if ($zoekresult && mysql_num_rows($zoekresult) > 0){
  67. echo "<br>";
  68. echo "Resultaten van: $gezochtNaar";
  69. echo "<br>";
  70. echo "<br>";
  71. echo "<table>";
  72. echo "<tr>";
  73. echo "<th>Studentnr.</th>";
  74. echo "<th>Voornaam</th>";
  75. echo "<th>Achternaam</th>";
  76. echo "<th>Geboortedatum</th>";
  77. echo "<th>Slb-er</th>";
  78. echo "</tr>";
  79.  
  80. while($result = mysql_fetch_array($zoekresult))
  81. {
  82. echo "<tr>";
  83.  
  84. ?>
  85. <td align="center" bgcolor="#FFFFFF"><input name="checkbox[]" type="checkbox" id="checkbox[]" value="<? echo $rows['studentnummer']; ?>"></td>
  86. <?
  87. echo "<td>".$result['studentnummer']."</td>";
  88. echo "<td>".$result['voornaam']."</td>";
  89. echo "<td>".$result['achternaam']."</td>";
  90. echo "<td>".$result['geboortedatum']."</td>";
  91. echo "<td>".$result['slb']."</td>";
  92. }}
  93. else {
  94. echo "geen resultaten";
  95. }
  96. echo "</tr>";
  97. ?>
  98. <tr>
  99.  
  100. <tr>
  101. <td colspan="5" align="center" bgcolor="#FFFFFF"><input name="delete" type="submit" id="delete" value="Delete"></td>
  102. </tr>
  103. </table>
  104. <?
  105. // Check if delete button active, start this
  106. if($delete){
  107. for($i=0;$i<$count;$i++){
  108. $del_id = $checkbox[$i];
  109. $sql = "DELETE FROM $tbl_name WHERE studentnummer='$del_id'";
  110. $result = mysql_query($sql);
  111. }
  112.  
  113. if($result){
  114. echo "<meta http-equiv=\"refresh\" content=\"0;URL=index.php\">";
  115. }
  116. }
  117. mysql_close();
  118. ?>
  119.  
  120. </div>
  121. <div id="footer">
  122. Intranet HHS
  123. </div>
  124.  
  125. </div>
  126. </body>
  127. </html>
  128.  
  129. <html>
  130. <head>
  131. <title>Haagse Hogeschool</title>
  132. <link rel="stylesheet" href="style.css" type="text/css" media="screen" />
  133. </head>
  134. <body>
  135. <div id="container">
  136. <div id="header">
  137. <img src="images/header.jpg" />
  138. </div>
  139. <div id="menu-links">
  140. <ul>
  141. <li><a href="" class="menu-link">Link 1</a></li>
  142. <li><a href="" class="menu-link">Link 2</a></li>
  143. </ul>
  144. </div>
  145. <div id="content">
  146.  
  147. <form name="search" method="post" action="zoek.php">
  148. Zoek naar: <input type="text" name="find" /> in
  149. <Select NAME="field">
  150. <Option VALUE="studentnummer">Studentnummer</option>
  151. <Option VALUE="voornaam">Voornaam</option>
  152. <Option VALUE="achternaam">Achternaam</option>
  153. <Option VALUE="slb">Slb-er</option>
  154. </Select>
  155.  
  156. <input type="hidden" name="searching" value="yes" />
  157. <input type="submit" name="zoek" value="Zoek"/><br />
  158. <center><a href ="allesweergeven.php" method="get" action="allesweergeven.php">alles weergeven</a></center>
  159. </form>
  160.  
  161. <?php
  162. /************************************
  163. * verbinding maken met de database *
  164. * *
  165. ************************************/
  166. require_once('connection.inc.php');
  167.  
  168. $sql="SELECT * FROM $tbl_name";
  169. $result=mysql_query($sql);
  170.  
  171. $count=mysql_num_rows($result);
  172.  
  173. ?>
  174. <table width="400" border="0" cellspacing="1" cellpadding="0">
  175. <tr>
  176. <td><form name="form1" method="post" action="">
  177. <tr>
  178. <td align="center" bgcolor="#FFFFFF">#</td>
  179. <td align="center" bgcolor="#FFFFFF"><strong>Studentnr</strong></td>
  180. <td align="center" bgcolor="#FFFFFF"><strong>Name</strong></td>
  181. <td align="center" bgcolor="#FFFFFF"><strong>Lastname</strong></td>
  182. </tr>
  183. <?php
  184. while($rows=mysql_fetch_array($result)){
  185. ?>
  186. <tr>
  187. <td align="center" bgcolor="#FFFFFF"><input name="checkbox[]" type="checkbox" id="checkbox[]" value="<? echo $rows['studentnummer']; ?>"></td>
  188. <td bgcolor="#FFFFFF"><? echo $rows['studentnummer']; ?></td>
  189. <td bgcolor="#FFFFFF"><? echo $rows['voornaam']; ?></td>
  190. <td bgcolor="#FFFFFF"><? echo $rows['achternaam']; ?></td>
  191. <td bgcolor="#FFFFFF"><? echo $rows['geboortedatum']; ?></td>
  192. <td bgcolor="#FFFFFF"><? echo $rows['slb']; ?></td>
  193.  
  194. </tr>
  195. <?php
  196. }
  197. ?>
  198. <tr>
  199. <td colspan="5" align="center" bgcolor="#FFFFFF"><input name="delete" type="submit" id="delete" value="Delete"></td>
  200. </tr>
  201. <?
  202. // Check if delete button active, start this
  203. if($delete){
  204. for($i=0;$i<$count;$i++){
  205. $del_id = $checkbox[$i];
  206. $sql = "DELETE FROM $tbl_name WHERE studentnummer='$del_id'";
  207. $result = mysql_query($sql);
  208. }
  209.  
  210. if($result){
  211. echo "<meta http-equiv=\"refresh\" content=\"0;URL=allesweergeven.php\">";
  212. }
  213. }
  214. mysql_close();
  215. ?>
  216.  
  217. </div>
  218. <div id="footer">
  219. Intranet HHS
  220. </div>
  221.  
  222. </div>
  223. </body>
  224. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement