Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $databaseHost = "localhost";
- $databaseUser = "root";
- $databasePassword = "";
- $databaseName = "register";
- $con=mysql_connect($databaseHost ,$databaseUser ,$databasePassword )or die ('Connection Error');
- mysql_select_db("register",$con) or die ('Database Error');
- ?>
- <span style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;font-size: small"><span style="line-height: 19px"> </span></span><?php
- if($_SERVER['REQUEST_METHOD'] == "POST")
- {
- $act=$_POST["name"];
- if($act=="")
- {
- $res=mysql_query("Select * from tbl_action"); // if ALL is selected in dropdown
- }
- else
- {
- $res=mysql_query("Select * from emp where action='".$act."'"); // if any action is selected
- }
- echo "<tr><td colspan='5'></td></tr>";
- while($r=mysql_fetch_row($res))
- {
- echo "<tr>";
- echo "<td align='center'>$r[0]</td>";
- echo "<td width='200'>$r[1]" . " $r[2]</td>";
- echo "<td align='center' width='40'> $r[3]</td>";
- echo "<td align='center' width='200'>$r[4]</td>";
- echo "<td width='100' align='center'>$r[5]</td>";
- echo "</tr>";
- }
- }
- ?>
- <span style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;font-size: small"><span style="line-height: 19px"> </span></span><?php
- include "config.php"; // including configuration file
- ?>
- <html>
- <body>
- <form name="frmdropdown" method="post" action=" tbl_action.php">
- <center>
- <h2 align="center">Employee Data</h2>
- <strong> Select Action : </strong>
- <select name="name">
- <option value1=""> ACCEPTED </option>
- <option value2=""> REJECTED </option>
- <?php
- $dd_res=mysql_query("Select DISTINCT Action from tbl_action");
- while($r=mysql_fetch_row($dd_res))
- {
- echo "<option value='$r[0]'> $r[0] </option>";
- }
- ?>
- </select>
- <input type="submit" name="find" value="find"/>
- <br><br>
- <table border="1">
- <tr align="center">
- <th>nic </th> <th>department </th> <th>name</th> <th>email</th>
- </tr>
- <?php
- if($_SERVER['REQUEST_METHOD'] == "POST")
- {
- $des=$_POST["name"];
- if($des=="") // if ALL is selected in Dropdown box
- {
- $res=mysql_query("Select * from emp");
- }
- else
- {
- $res=mysql_query("Select * from emp where Action='".$act."'");
- }
- echo "<tr><td colspan='5'></td></tr>";
- while($r=mysql_fetch_row($res))
- {
- echo "<tr>";
- echo "<td align='center'>$r[0]</td>";
- echo "<td width='200'>$r[1]" . " $r[2]</td>";
- echo "<td alig='center' width='40'> $r[3]</td>";
- echo "<td align='center' width='200'>$r[4]</td>";
- echo "<td width='100' align='center'>$r[5]</td>";
- echo "</tr>";
- }
- }
- ?>
- </table>
- </center>
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement