Jump to content

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.