hello guys,

how can i display the data from php mysql with text decoration for example underline or a dotted line css/html?

thanks.

Member Avatar for diafol

Exactly as you've mentioned. Output the data into a tag (possibly with a suitable classname), e.g.

echo "<blockquote>{$data['quote']}</blockquote>";

or

echo "<span class='special'>{$data['special']}</span>";

THen if you've got CSS rules:

.special{
    text-decoration: none;
    border-bottom: 1px blue dotted;
}
blockquote{
    border: 1px single black;
}

Dear earlxph8, if you know how to use html this will be very easy for you.

In html file you directly write
<p>Sample test</p>

however in PHP, you have to echo the html:
<?php echo "<p>Sample test</p>";?>

When you echo a string, it will be treated as a html text, so all html tags will work when echoed.
What is even more important is that you can edit the style of the tags exactly like you do in html, taking the same example:

HTML:

<p style="text-decoration:underline;">Sample Test</p>

In PHP:

<?php echo "<p style=\"text-decoration:underline;\">Sample Test</p>";?> *//the \ is to tell PHP that the string is not finished yet, so it will not end it.*

OR

<?php echo '<p style="text-decoration:underline;">Sample Test</p>';?> /*//no need for the \*/

With MYSQL, you can store an HTML block with it's style as it is in the database. When you echo the data using php, it will be treated as HTML.

Good Luck, For any other information feel free to ask :)

I Agree with These guys , but my favouraite way to combine html + PHP is like that

<div><?php echo "This is new paragraph generated by PHP ?> </div>

This really Makes it easier for complex multiplication

this is very helpul guys. thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.