If variable $single = 1 and variable $double = 2
I want a result like this image : https://i.sstatic.net/1IivO.jpg
I try the code like this :
<?php
$Sgl = 1;
$Dbl = 2;
$Trp = 0;
?>
<table border="1">
<tr>
<td>No</td>
<td>Room Type</td>
<td>Room Grade</td>
<td>Gender</td>
<td>Family Name</td>
<td>First Name</td>
</tr>
<?php
$no = 1;
for($i=0; $i< ($Sgl ? $Sgl : ($Dbl ? $Dbl : ($Trp ? $Trp : 0))); $i++) {
if($Sgl)
$room_type = 'Single';
else if($Dbl)
$room_type = 'Double';
else if($Trp)
$room_type = 'Triple';
?>
<tr>
<td><?php echo $no; ?></td>
<td><?php echo $room_type; ?></td>
<td>Standart Room</td>
<td>
<select>
<option selected>Mr.</option>
<option>Ms</option>
<option>Mrs</option>
<option>Mstr</option>
</select>
</td>
<td>
<input type="text" class="" placeholder="Family Name">
</td>
<td>
<input type="text" class="" placeholder="First Name">
</td>
</tr>
<?php
$no++;
}
?>
</table>
But it seems the code is still wrong
How to keep the results as the image above?
Any help much appreciated?
Cheers
variable $single = 1andvariable $double = 2, then the result like this image : imgur.com/U0zxCgI. I have tried like the above code, but it failed