karpagam Posted April 23, 2010 Share Posted April 23, 2010 Hi All.. Can you give me an idea about how to generate random Background images in php? I am having two files currently now. One is index.php and another one is style.css. I called the bg image css file in index.php. Now it showed me that bg image in front end. Likely, I have to generate random bg images in that. I tried the below coding.. <div id="bgImg" style="background:url(/images/<?php "img_".rand(0,1000).".gif"; ?>) no-repeat top left;">aaaaaaa</div> But its not going into PHP statement. Its not working. How to do tat? Anyone please tell me.. Thanks in advance......... Link to comment https://forums.phpfreaks.com/topic/199462-need-help-in-css-background-from-php-random-image-script/ Share on other sites More sharing options...
andrewgauger Posted April 23, 2010 Share Posted April 23, 2010 You need to fast echo the line <?php "img_".rand(0,1000).".gif"; ?> as <?php="img_".rand(0,1000).".gif"; ?> Link to comment https://forums.phpfreaks.com/topic/199462-need-help-in-css-background-from-php-random-image-script/#findComment-1047231 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.