N0L1m1t5 Posted August 1, 2011 Share Posted August 1, 2011 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 Link to comment https://forums.phpfreaks.com/topic/243522-how-to-give-a-php-document-a-background-image/ Share on other sites More sharing options...
manix Posted August 1, 2011 Share Posted August 1, 2011 <?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 ?> this should do it Link to comment https://forums.phpfreaks.com/topic/243522-how-to-give-a-php-document-a-background-image/#findComment-1250436 Share on other sites More sharing options...
N0L1m1t5 Posted August 2, 2011 Author Share Posted August 2, 2011 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 Link to comment https://forums.phpfreaks.com/topic/243522-how-to-give-a-php-document-a-background-image/#findComment-1250526 Share on other sites More sharing options...
manix Posted August 2, 2011 Share Posted August 2, 2011 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 Link to comment https://forums.phpfreaks.com/topic/243522-how-to-give-a-php-document-a-background-image/#findComment-1250593 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.