根据显示约会是否可用的状态。我希望显示状态是否可用,用户将通过指向新页面的链接重定向,如果约会不可用,则状态将被隐藏。不知道我哪里错了..
</thead>
<tbody>
<?php
if(is_array($appointmentdetails) || isset($displayAppointment)){
foreach($appointmentdetails as $displayAppointment) { ?>
<tr>
<td><?php print $displayAppointment['DOCTOR_LICENSE_NO']; ?></td>
<td><?php print $displayAppointment['DOCTOR_FNAME']; ?></td>
<td><?php print $displayAppointment['DOCTOR_LNAME']; ?></td>
<td><?php print $displayAppointment['DOCTOR_EMAIL_ID']; ?></td>
<td><?php print $displayAppointment['DOCTOR_PHONE']; ?></td>
<td><?php print $displayAppointment['APPOINTMENT_DATE']; ?></td>
<td><?php print $displayAppointment['APPOINTMENT_TIME']; ?></td>
--> Here I want to display the given condition
<?php if($displayAppointment['APPOINTMENT_STATUS']=="Available")
{ ?>
<td><a href="input_user.php?APPOINTMENT_STATUS=<?php print $displayAppointment['APPOINTMENT_STATUS']; ?>"><?php print $displayAppointment['APPOINTMENT_STATUS']; ?></a></td>
<?php }
else ?>
<?php {?>
<td><?php print $displayAppointment['APPOINTMENT_STATUS']; ?></td>
<?php}?>
</tr>
<?php } } ?>
</tbody>
</table>
</body>
答案 0 :(得分:1)
在数据库/或列表中创建一个字段作为约会状态,如果约会可用,则将其设为true,否则为false。 并在if else语句中使用它
if($displayAppointment['APPOINTMENT_STATUS'])
{
echo "Appointment available" ; //or what ever your link
}
else
{
echo "redirect";
}
答案 1 :(得分:0)
在php代码中,在打开if括号之前放置语句echo。同样在if语句中,它应该是$ displayAppointment ['APPOINTMENT_STATUS']
<?php if($displayAppointment['APPOINTMENT_STATUS']=="Available")
{
//put echo here
echo 'APPOINTMENT_STATUS'; ?>
<td><a href="input_user.php?APPOINTMENT_STATUS=<?php print $displayAppointment['APPOINTMENT_STATUS']; ?>"><?php print $displayAppointment['APPOINTMENT_STATUS']; ?></a></td>
<?php }
else {?>
<td> <input type="hidden" name="APPOINTMENT_STATUS" value="<?php print $displayAppointment['APPOINTMENT_STATUS'];?>" ></td>
<?php}?>
答案 2 :(得分:0)
This is Youre Code :
<td><?php print $displayAppointment['APPOINTMENT_STATUS']; ?></td>
<?php}?>
Need space after <?php
Right Code :
<td><?php print $displayAppointment['APPOINTMENT_STATUS']; ?></td>
<?php }?>