tags:

views:

70

answers:

3
<?php
    if (mysqli_num_rows($new_result) == 1)
        {
            if ($row['borrowingPower'] == 'mayor')
                print "<div id='verified'>This User is Verified!<div>";
        }
?>

In addition to the text "This User is Verified", how can I make an image display just to the right or just above the text?

ADDED TEST FILE FOR THIS WORK http://neighborrow.com/wanted_test.php?item=116

+5  A: 

With an img element (note that the section on alt text is a little lacking in that article, so also see this document).

David Dorward
I think a background image would be better, semantically
K Prime
It wouldn't. The semantics would be the same.
David Dorward
… and from the perspective of separation of concerns, the icon conveys information, so it is content, not presentation.
David Dorward
+2  A: 

With an <img> tag:

<?php
    if (mysqli_num_rows($new_result) == 1)
        {
            if ($row['borrowingPower'] == 'mayor')
                print "<div id='verified'>This User is Verified! <img src='icon_ok.png' style='vertical-align: middle' alt='' /><div>";
        }
?>
amercader
"The user is Verified! Verified!" — that alt text could use a little work.
David Dorward
@David Dorward, Better now?
amercader
"This User is Verified! The user was successfully verified" — still packed with redundant/duplicate information. If the image just illustrates content that already appears in the text, just use `alt=""`.
David Dorward
OK then, an empty <code>alt</code> tag. Thanks for pointing it out.
amercader
+3  A: 

another way to do this is adding a css class to your DIV element

CSS code:

.user_verified {
    background: url(../images/user_verified.png) no-repeat 0 0;
    padding-left:20px;
}

PHP code:

<?php
    if (mysqli_num_rows($new_result) == 1)
        {
            if ($row['borrowingPower'] == 'mayor')
                print "<div id='verified' class='user_verified'>This User is Verified!<div>";
        }
?>
Guillaume Boschini
Best answer ever!
Romain Verdier