I have this HTML tag (body):
<body onload="startTime()" background="src/bg3.png">
and I was trying to change background on refresh so I replaced the HTML tag with this PHP code:
<?php
$id = rand(1, 7);
echo "<body onload=".'"'."startTime()".'"'."background=".'"'."src/bg". $id . ".png".'"'.'>';
?>
which returns:
<body onload="startTime()" background="src/bg5.png">
where the number after bg is a random between 1 and 7.
But the problem is that when I inspect element the body tag is simply:
<body>
Does PHP only allow HTML code insertion if it's being returned by a function?