Jump to content

[SOLVED] need help with proper syntax


jeff5656

Recommended Posts

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

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.