Advertisement
Guest User

Untitled

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