html - How to change background image with the help of url parameter in php?
I'm trying to change background image of a simple php page with help url parameter. I'm very newbie and don't know much coding.
<img width="250" src="https://i.imgur.com/<?php echo $_GET['img']; ?>.png">
When i use the above code in url i will get desire image from imgur.com by just entering the image link for example:
http://example.com/?img=frotzyG (full image url: https://i.imgur.com/frotzyG.jpg)
but it just show in a div e.g.
<div class="abc">
<img width="250" src="https://i.imgur.com/<?php echo $_GET['img']; ?>.png">
</div>
Now i want the same thing to happen for background image. I have a simple php page and its background image source is located in a css (e.g stylesheet.css)
Here's CSS file code:
body {
background: url(images/bg.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
How to change background image with the help of url parameter (or whatever you call it.)
P.S. Sorry for my bad English, hope you understand my point.
Answer
Solution:
You might move css related to background image into HTML using style tag.