Jump to content
KenHorse

Can't change color of a field

Recommended Posts

Consider the following snippet:

print "    
                
<td align=\"center\">";
if($row[changed]){print "<B><RED>";}                      
print "<a href=\"editmacrorc.php?id=$row[id]&port=$port&tab=$tab\">";    

        

The tag <RED> is a CSS entry that works fine in other code I use:

RED {color:red}


            
As you may see, we read in data from a MySQL database and if the 'changed' field contains a '1', we want to make the displayed character bolded and also RED. And if that character is clicked, take us to the new php file (that all works fine). But only the BOLD is displayed but it is not in RED.

Not really sure if this an HTML or PHP issue but help!   :D

Share this post


Link to post
Share on other sites

CSS

<style type='text/css'>
    .redlink {color: red; font-weight: 600}
</style>

HTML

<a class="redlink" href="whatever">Hello World</a>

 

Share this post


Link to post
Share on other sites

You have numerous basic errors. You are missing a period before the RED css. You are also missing quotes on your row variables. If you had error reporting turned on you would have known about that. If you used single quotes in your html strings you wouldnt have to do all that escaping. The center tag is obsolete. You will also get an error with your row[id]. It will need to be {row['id']}. If this is not for tabular data, then don't use tables

Edited by benanamen

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • 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.