Advertisement
Guest User

Untitled

a guest
Dec 4th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.27 KB | None | 0 0
  1. <?php
  2. $databaseHost = "localhost";
  3. $databaseUser = "root";
  4. $databasePassword = "";
  5. $databaseName = "register";
  6.  
  7. $con=mysql_connect($databaseHost ,$databaseUser ,$databasePassword )or die ('Connection Error');
  8. mysql_select_db("register",$con) or die ('Database Error');
  9. ?>
  10.  
  11.  
  12.  
  13. <span style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;font-size: small"><span style="line-height: 19px"> </span></span><?php
  14. if($_SERVER['REQUEST_METHOD'] == "POST")
  15. {
  16. $act=$_POST["name"];
  17. if($act=="")
  18. {
  19. $res=mysql_query("Select * from tbl_action"); // if ALL is selected in dropdown
  20. }
  21. else
  22. {
  23. $res=mysql_query("Select * from emp where action='".$act."'"); // if any action is selected
  24. }
  25. echo "<tr><td colspan='5'></td></tr>";
  26. while($r=mysql_fetch_row($res))
  27. {
  28. echo "<tr>";
  29. echo "<td align='center'>$r[0]</td>";
  30. echo "<td width='200'>$r[1]" . " $r[2]</td>";
  31. echo "<td align='center' width='40'> $r[3]</td>";
  32. echo "<td align='center' width='200'>$r[4]</td>";
  33. echo "<td width='100' align='center'>$r[5]</td>";
  34. echo "</tr>";
  35. }
  36. }
  37. ?>
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44. <span style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;font-size: small"><span style="line-height: 19px"> </span></span><?php
  45. include "config.php"; // including configuration file
  46. ?>
  47. <html>
  48. <body>
  49. <form name="frmdropdown" method="post" action=" tbl_action.php">
  50. <center>
  51. <h2 align="center">Employee Data</h2>
  52.  
  53. <strong> Select Action : </strong>
  54. <select name="name">
  55. <option value1=""> ACCEPTED </option>
  56. <option value2=""> REJECTED </option>
  57. <?php
  58.  
  59. $dd_res=mysql_query("Select DISTINCT Action from tbl_action");
  60. while($r=mysql_fetch_row($dd_res))
  61. {
  62. echo "<option value='$r[0]'> $r[0] </option>";
  63. }
  64. ?>
  65. </select>
  66. <input type="submit" name="find" value="find"/>
  67. <br><br>
  68.  
  69. <table border="1">
  70. <tr align="center">
  71. <th>nic </th> <th>department </th> <th>name</th> <th>email</th>
  72. </tr>
  73.  
  74. <?php
  75. if($_SERVER['REQUEST_METHOD'] == "POST")
  76. {
  77. $des=$_POST["name"];
  78. if($des=="") // if ALL is selected in Dropdown box
  79. {
  80. $res=mysql_query("Select * from emp");
  81. }
  82. else
  83. {
  84. $res=mysql_query("Select * from emp where Action='".$act."'");
  85. }
  86.  
  87. echo "<tr><td colspan='5'></td></tr>";
  88. while($r=mysql_fetch_row($res))
  89. {
  90. echo "<tr>";
  91. echo "<td align='center'>$r[0]</td>";
  92. echo "<td width='200'>$r[1]" . " $r[2]</td>";
  93. echo "<td alig='center' width='40'> $r[3]</td>";
  94. echo "<td align='center' width='200'>$r[4]</td>";
  95. echo "<td width='100' align='center'>$r[5]</td>";
  96. echo "</tr>";
  97. }
  98. }
  99. ?>
  100. </table>
  101. </center>
  102. </form>
  103. </body>
  104. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement