So I am trying to get it do it will choose either 1.jpg 2.jpg or 3.jpg. My guess is I am doing this wrong but I am getting no php errors nor is my IDE telling my that my CSS is wrong, so I have nothing to go on.
Code:
HTML/CSS:
<html>
<head>
<link rel="stylesheet" href="css/styles.css" type="text/css" media="all">
<script type="text/javascript" src="js/jquery-1.4.2.min.js" ></script>
<?php
include 'php/backgorundlogic.php';
?>
<style>
body {
background:url($bgset);
background-size:cover;
}
</style>
</head>
<body>
<div class="container">
<input class="searchbar" type="text" />
</div>
</body>
</html>
PHP:
<?php
$rbg = mt_rand(1, 3);
$ext = '.jpg';
$bgset = 'img/' + $rbg + $ext;
?>
DEMO: here
$bgsetis a valid image filename ;)backgorundlogic.php, orbackgroundlogic.php?