1

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
  • 207,509
  • 96
  • 428
  • 469
  • 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

3 Answers3

1

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,266
  • 13
  • 22
  • 1
    +1 for css. You could use this `$message = '
    ...
    ` and in your css use this: `.center{text-align:center;}`
    – ABC Feb 16 '14 at 14:40
0

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,064
  • 1
  • 10
  • 23
0

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
  • 319
  • 4
  • 8