Hello, I want to insert some images into a background using php. I know normally for background images you do this. <body style="background: url(http://www.website.com/a.gif);"> Where does the PHP go, doing it with PHP? Please let me know, thanks very much.
<?php echo "<body style='background: url(http://www.website.com/a.gif);'>"; ?> PHP: Basically, it is the same as the HTML you are using, although you could save that in an external .php file and use include(), BP
you can also insert directely html lines in a php file. End the php section with the ?> tag, write yours html line en open an other php section with <?php tag. for example : <?php include "conf.inc.php"; ?> <body style="background: url(http://www.website.com/a.gif);"> <? echo "hello world"; ?>
Not one person asked why are you doing this with PHP. Why would you? Take a look at how to utilize CSS with your HTML.
You can simply do <body style="background: url(http://www.website.com/<?php echo 'a.gif' ?>);"> and replace "echo 'a.gif'" with any PHP code of your choice that calculates the right picture. You can also echo a variable that was set previously.