Only show link if conditional equals true
- by Dave Morin
I want the link to appear only when $data['block'] equals to 1, 3 or 4. Not if it equals to 2 or 5.
<td style="font-size:18px;color:#f0cb01;">
<a href="kickcodes.php?id='.$data["block"].'">Reason Codes</a>
</td>
EDIT
while ($data = mysql_fetch_array($query)) {
echo '
<tr style="background-color:#576c11;">
<td style="font-size:18px; color:#f0cb01;">'.$data["keyword"].'</td>
<td style="font-size:18px;color:#f0cb01;">'.$data["block"].'</td>
<td style="font-size:18px;color:#f0cb01;">'.$data["phone"].'</td>
<td style="font-size:18px;color:#f0cb01;">'.$data["Reason"].'</td>
<td style="font-size:18px;color:#f0cb01;"><a href="kickcodes.php?id='.$data ["block"].'">Kickcodes</a></td>'
echo '<td style="font-size:18px;color:#f0cb01;">';
if( $data['block'] == 1 || $data['block'] == 3 || $data['block'] == 4)
{
echo '<a href="kickcodes.php?id='.$data["block"].'">Reason Codes</a>';
} else
{
echo '<span>Reason Codes</span>'; // Or echo nothing
}
echo '</td>';