Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <form name="frmdropdown" id="frmdropdown" method="post" action="" >
- <div align="center">
- <h2 align="center">List of 'actor'</h2>
- <strong> Select actor : </strong>
- <select name="name" id="name" onchange="onSelectChange();">
- <option value="">----ALL----</option>
- <?php
- $dd_res = mysqli_query($conn, "Select name from actor");
- while ($row = mysqli_fetch_array($dd_res)) {
- echo "<option value='".$row['name']."'>".$row['name']."</option>";
- }
- ?>
- </select>
- <input type="submit" name="find" value="find"/>
- <input type="reset" name="name" onclick="deleteRows('tbl', false);" value="Reset">
- <br><br>
- <table id="tbl" border="1">
- <tr align="center">
- <th align='center' width='100'>Actor Id </th>
- <th align='center' width='100'>Name </th>
- <th align='center' width='150'>Path</th>
- <th align='center' width='80'>Avatar</th>
- </tr>
- <?php
- if($_SERVER['REQUEST_METHOD'] == "POST") {
- $des = $_POST["name"];
- if ($des == "") // if ALL is selected in Dropdown box
- {
- $res = mysqli_query($conn, "Select * from actor order by actor_id desc ");
- } else {
- $res = mysqli_query($conn, "Select * from actor where name='" . $des . "'");
- }
- // echo "<tr><td colspan='5'></td></tr>";
- while ($row = mysqli_fetch_array($res)) {
- echo '<tr>
- <td align="center" width="100">'.$row['actor_id'].'</td>
- <td align="center" width="100">'.$row['name'].'</td>
- <td align="center" width="150">'.$row['path'].'</td>
- <td align="center" width="80"><img src="data:image/jpeg;base64,'.base64_encode($row['avatar'] ).'" height="50" width="40" class="img-thumnail" /></td>
- </tr>';
- }
- /* echo '<img src="'.($row['image']).'" height="50" width="40" class="img-thumnail" />';*/
- }
- ?>
- </table>
- </div>
- </form>
- <!-------- form ------------>
- <script>
- function onSelectChange() {
- document.getElementById('frmdropdown').submit();
- }
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement