Jump to content

How to make a row bold


GregF

Recommended Posts

Hey everyone

 

Just wondering if any of you can point me in the right direction.

 

I have created a table that displays the content from a database.

I have also created a form that posts to the database.

 

On this form I have a checkbox. 

 

I have set a column in phpmyadmin table to enum '1','0' (feel free to tell me if this is wrong - i'm a newbie)

 

What I want to do is, if the value is set to one, then the content of the table row <tr> is to be displayed in bold.

 

I have searched around and tried to piec the code together but am having no luck.

 

Just wondering if anyone could assist??

 

Many thaks in advance

 

G

Link to comment
https://forums.phpfreaks.com/topic/275981-how-to-make-a-row-bold/
Share on other sites

So you have the content from the database... now set a variable that triggers either an inline style or a class. Something like this

 

 

//this says if your checkbox is 1 then $boldMe has the style, if it is 0 it has an empty string
$boldMe = $db_data['yourcheckboxfield'] ? " style='font-weight:bold;'" : '';
 
//then in your td tag
'<td'.$boldMe.'>

 

Of course this is just a simple example but hopefully you get the idea. You just need to use a variable that checks what the value of the checkbox is and then inserts either a class, a style, or the full style string to bold the text.

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.