jeff5656 Posted October 8, 2008 Share Posted October 8, 2008 I want to display the word "active" if signoff_status=a otherwise I want to display the word "off". How do I do that? Here's the code that gives me an error message after the IF statement: <td align="center" width=5%><a href="updatesignoff.php?action=edit&id=<?php echo $row['id_incr']; ?>"><h3> <?php if $row['signoff_status'] = 'a' echo "Active" else echo "off";?></a> </h3></td> Link to comment https://forums.phpfreaks.com/topic/127613-solved-need-help-with-proper-syntax/ Share on other sites More sharing options...
F1Fan Posted October 8, 2008 Share Posted October 8, 2008 <?php if ($row['signoff_status']=='a') echo "Active"; else echo "off"; ?> Link to comment https://forums.phpfreaks.com/topic/127613-solved-need-help-with-proper-syntax/#findComment-660294 Share on other sites More sharing options...
DarkWater Posted October 8, 2008 Share Posted October 8, 2008 Spacing things out helps a lot: <td align="center" width=5%><h3><a href="updatesignoff.php?action=edit&id=<?php echo $row['id_incr']; ?>"> <?php if ($row['signoff_status'] == 'a') { echo "Active"; } else { echo "off"; } ?></a> </h3></td> Also, you missed a ; after echo "Active", you used only 1 = on the comparison (2 should be used), and you can't put an <a> around an <h3>, but it can be the other way around. Link to comment https://forums.phpfreaks.com/topic/127613-solved-need-help-with-proper-syntax/#findComment-660296 Share on other sites More sharing options...
jeff5656 Posted October 8, 2008 Author Share Posted October 8, 2008 Thanks to both of you - it is solved. Link to comment https://forums.phpfreaks.com/topic/127613-solved-need-help-with-proper-syntax/#findComment-660299 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.