2

How do I display my image on the center of my page I tried

<center><?php
        }
        else
        {
            $form = true;
            $message = 'The username or password you entered are not good.';
        }
    }
    else
    {
        $form = true;
    }
    if($form)
    {
?></center>

But it didn't work..

John Conde
  • 217,595
  • 99
  • 455
  • 496
  • does it display the message? – Esqarrouth Feb 16 '14 at 14:36
  • 1
    Don't use
    tags, use CSS to position your output. Additionally, restructure your code so that it's obvious what the conditionals are doing. I can't see the if statements in here, and you run a high risk of something failing and the
    tags not even being output in the first place.
    – Zarathuztra Feb 16 '14 at 14:39

4 Answers4

2

Try this:

<?php } else {
      $form = true;
      $message = '<div style="text-align: center;>The username or password you entered are not good.</div>';
     }
    } else {
        $form = true;
    }
    if($form)
    {
?>

However, you should be doing this in your CSS file.

Banago
  • 1,350
  • 13
  • 22
  • 1
    +1 for css. You could use this `$message = '
    ...
    ` and in your css use this: `.center{text-align:center;}`
    – ggirtsou Feb 16 '14 at 14:40
1

Add inline CSS style like below

$message = '<span style = "text-align:center">The username or password you entered are not good.</span>';
    echo $message;
Chethan N
  • 1,110
  • 1
  • 9
  • 23
1

Code you posted is syntactically broken.

For centering in HTML you can use style like this one:

<div style='text-align: center'>Your message</div>

For print text from PHP to HTML output, use echo:

echo $message;

Together:

<div style='text-align: center'><?php echo $message; ?></div>
Eda
  • 388
  • 5
  • 9
1

Add this to the STYLE area above the PHP

<style type="text/css">
    body,td,th {
    font-size: 14px;
    color: #FFFFFF;
    text-align: center;
}
</style>