Forum Moderators: coopster

Message Too Old, No Replies

PHP Bold

Making the text bold

         

Saint Honore

6:31 pm on Jul 5, 2006 (gmt 0)

10+ Year Member



Hi,
I have a field, which store and retrive data from a table. I need to add the html tag <b></b> to make the perticular content as bold and display on frontpage.

Kindly Suggest

henry0

7:36 pm on Jul 5, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hello SaintHonore,
Welcome to WebmasterWorld!
That should be a "Piece of cake"... Pardon me couldn't resist.

Please post the section of code you refer to.

barns101

7:55 pm on Jul 5, 2006 (gmt 0)

10+ Year Member



Do you want to add the bold tags to the stored data or add them when displaying the data? The second scenario simply requires you to edit the HTML that you output and add the bold tags to it.

IanKelley

10:42 pm on Jul 5, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Doesn't sound like it's his own code.

With that in mind, it would make more sense to add the tags while displaying. No need to store so much redundant data in the DB, especially when the formatting could change in the future. So...

print '<b>'.$thingFromDB.'</b>';

mrWoot

1:57 am on Jul 6, 2006 (gmt 0)

10+ Year Member



Try this:
echo '<strong>', $variable, '</strong>';

Saint Honore

7:55 pm on Jul 18, 2006 (gmt 0)

10+ Year Member



Hello,
I have tried the above suggested methods and it works, but now i get back slashes if i have colon's or if i have 1 backslahes i get 4-5 backslashes.

eelixduppy

9:15 pm on Jul 18, 2006 (gmt 0)



The slashes could be a combination of how you are using addslashes or mysql_real_escape_string while having magic_quotes [us2.php.net] enabled. If you want, you can use stripslashes [us2.php.net] on the text to get rid of the slashes.

Best of luck!