Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <form method="post" action="index.php">
- <select name="month" id="month">
- <option></option>
- <option value="1">January</option>
- <option value="2">February</option>
- <option value="3">March</option>
- <option value="4">April</option>
- <option value="5">May</option>
- <option value="6">June</option>
- <option value="7">July</option>
- <option value="8">August</option>
- <option value="9">September</option>
- <option value="10">October</option>
- <option value="11">November</option>
- <option value="12">December</option>
- </select>
- <input type="submit" value="submit" name="submit"/>
- <?php
- $hostname="localhost";
- $username="root";
- $password="";
- $dbname="testproduct";
- $db = new mysqli($hostname, $username, $password, $dbname);
- $stmt = $db->stmt_init();
- //
- if(!$stmt->bind_param('s', $month)) {
- //if BIND fails, display an error
- printf("Errormessage: %sn", $stmt->error);
- }
- $month = isset($_POST['month'])
- ? $db->real_escape_string($_POST['month'])//this 'month' is the select name
- : '';
- if(!$stmt->execute()) {
- printf("Errormessage: %sn", $stmt->error);
- }
- if(!$stmt->bind_result($fname,$lname,$checkin,$checkout,$rrate,$reservefee,$datepaid,$modepayment,$stats))//name of db rows and also the only information I want to show on the web {
- printf("Errormessage: %sn", $stmt->error);
- }
- while($row=$stmt->fetch()) {
- ?>
- <tr>
- <td><?php echo $row['fname']; ?></td>
- <td><?php echo $row['lname']; ?></td>
- <td><?php echo $row['checkin']; ?></td>
- <td><?php echo $row['checkout']; ?></td>
- <td><?php echo $row['rrate']; ?></td>
- <td><?php echo $row['reservefee']; ?></td>
- <td><?php echo $row['datepaid']; ?></td>
- <td><?php echo $row['modepayment']; ?></td>
- <td><?php echo $row['stats']; ?></td>
- <td align="center">
- <a id="<?php echo $row['fname']." ".$row['lname']; ?>" class="edit-link" href="#" title="Edit">
- <img src="edit.png" width="20px" />
- </a></td>
- <td align="center"><a id="<?php echo $row['fname']." ".$row['lname']; ?>" class="delete-link" href="#" title="Delete">
- <img src="delete.png" width="20px" />
- </a></td>
- </tr>
- <?php
- }
- }
- ?>
- </tbody>
- </table>
- </div>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement