I have got 3 tennis courts which you can reserve. Now I need to check which court is reserved. This is very messy in php. I need to check:
Is court 1 reserved? If yes is court 2 reserved? If yes is court 3 reserved?... You get the point
Here is my code:
if($counter != 0){
if($counter2 != 0){
if($counter3 != 0){
//Alle Plätze besetzt
?>
<td>"R"</td>
<td>"R"</td>
<td class="td-border-right">"R"</td>
<?php
}else{
//PLatz 1 u 2 besetzt, 3 nicht
?>
<td>"R"</td>
<td>"R"</td>
<td class="td-border-right"></td>
<?php
}
}
else if($counter3 != 0){
//PLatz 1 u 3besetzt, 2 nicht besetzt
?>
<td>"R"</td>
<td></td>
<td class="td-border-right">"R"</td>
<?php
}else{
?>
<td>"R"</td>
<td>"R"</td>
<td> class="td-border-right"></td>
<?php
}
}else {
if($counter2 != 0){
if($counter3 != 0){
?>
<td></td>
<td>"R"</td>
<td class="td-border-right">"R"</td>
<?php
}
else{
?>
<td></td>
<td>"R"</td>
<td class="td-border-right"></td>
<?php
}
}else{
if($counter3 != 0){
?>
<td></td>
<td></td>
<td class="td-border-right">"R"</td>
<?php
}else{
?>
<td></td>
<td></td>
<td class="td-border-right"></td>
<?php
}
}
}
?>
counter 1,2 and 3 are just placeholders for the moment.
Aucun commentaire:
Enregistrer un commentaire