I build my website for fun and want to put different banner on each page, in my header i have random banners who appear with this code,
<div style=' height:145px; background-image:url(images/banners/banner<?php
echo rand(1,3); ?>.jpg); background-position:center center; border-
radius:4px;'></div>
So there is 3 banners and each time i refresh random one appear, but i want to have another 3 banners for my other page but with the same include"inc/header.php", maybe 'if' statement could work but i really don't know how to do it. Sorry for my English i'm french.
Assuming the three banners are in the same folder, the following would be a simple solution:
Place the banner code in a separate file:
banner.php
Then you can call it from your page:
This is not the most elegant solution, but it's a simple nice simple one for a novice programmer that introduces some concepts.