Jump to content

How to give a php document a background image?


N0L1m1t5

Recommended Posts

This is the code I have if a user enters the wrong password into the basic username and password field,

 

 

<?php

else

    echo "<br><br><center><h1>Error:</h1>Incorrect Password!</center>";

?>

 

How can I give this page a background image, using css? Where would i put the code?

 

Thanks

When you say to post this:

 

<?php

else

    echo "<br><br><center><h1>Error:</h1>Incorrect Password!</center>";

?>

<style type='text/css'>

body { background-color: color; }

</style>

<?

if you have more stuff here

?>

 

 

did you intentionally not write a beginning <?php before the sentence "<style type...." and an ending ?> after the ending </style> tag??

Thanks

the style tag is not in php therefore you don't need php opening/closing tags. Also I just copied the code from your post without noticing you don't have function brackets {} which are supposed to be put like this

 

<?php
else{
echo "<br><br><center><h1>Error:</h1>Incorrect Password!</center>";
?>
<style type='text/css'>
body { background-color: color; }
</style>
<?php
}
?>

 

you could either do

 

<?php
else{
echo "<br><br><center><h1>Error:</h1>Incorrect Password!</center>";
echo "
<style type='text/css'>
body { background-color: color; }
</style>";
}
?>

 

but if you validate this code it's going to say you can not place style tags in the body tag, which I don't understand why because they work and don't seem to have any complications, so if someone more competent could explain why the validators say this is wrong I'd be grateful too

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.