Hello, I want to create update button for each table row. I displayed data from table succesufuly, but I dont know hot to update status of reservation session.I will post my code here.
I am new in php so sorry for stupid question…
<?php
//displayResStatus.php
require_once "db.php";
class displayResStatus extends ConnToDB {
public function displayStatusNone() {
$sql = "SELECT * FROM reservation WHERE SESSION_STATUS='NONE'";
$result = $this->Connection()->query($sql);
echo '<table border="1" cellpadding="5">
<tr>
<th>Name</th>
<th>Lastname</th>
<th>E-mail</th>
<th>Phone number</th>
<th>Gender</th>
<th>Session</th>
<th>Session status</th>
<th>Change session status</th>
</tr>';
if ($result) {
while ($row = mysqli_fetch_assoc($result)) {
$name = $row["NAME"];
$lastname = $row["LASTNAME"];
$email = $row["EMAIL"];
$phone = $row["PHONE"];
$gender = $row["GENDER"];
$session = $row["SESSION"];
$sessionStatus = $row["SESSION_STATUS"];
echo '<tr>
<td>'.$name.'</td>
<td>'.$lastname.'</td>
<td>'.$email.'</td>
<td>'.$phone.'</td>
<td>'.$gender.'</td>
<td>'.$session.'</td>
<td>'.$sessionStatus.'</td>
<td>'?>
<form method="#" action="#">
<select name="selectStatus">
<option name="status" value="Confirmed session">Confirmed session</option>
<option name="status" value="Unconfirmed session">Unconfirmed session</option>
</select>
<input type="submit" name="submit" value="Update status"/>
</form>
<?php '</td>
<tr>';
}
}
echo '</table>';
}
}
?>