GregF Posted March 21, 2013 Share Posted March 21, 2013 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 More sharing options...
yomanny Posted March 21, 2013 Share Posted March 21, 2013 Add a CSS rule to the <tr> in case it should be bold, like this: <tr style="font-weight: bold;"> But if you plan to style your stuff more later on, read up on CSS and create classes in .css files instead. - W Link to comment https://forums.phpfreaks.com/topic/275981-how-to-make-a-row-bold/#findComment-1420168 Share on other sites More sharing options...
akphidelt2007 Posted March 21, 2013 Share Posted March 21, 2013 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. Link to comment https://forums.phpfreaks.com/topic/275981-how-to-make-a-row-bold/#findComment-1420173 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.