I am attempting to make the TOP and LEFT parameters of this DIV class variable. Here are snippets of my code
First in the style.php file:-
<?php
header("Content-type:text/css");
$top='100';
$left='200';
?>
.testbox {
float:left;
position:absolute;
top:<?php echo $top; ?>px;
left:<?php echo $left; ?>px;
background-size:2000px 2000px;
background-repeat:no-repeat;
background-color:#FFFFFF;
width:50px;
height:100px;
border:1px solid #b3bdc2;
z-index:1;
}
In my main script (gettrains.php)
$top='100';
$left='500';
echo "<div style='top:$top;left:$left' class='testbox'>
<p>$answer</p>
</div>";
I have also put the below line into my gettrains.php script
<link href="style.php" type="text/css" rel="stylesheet" />
I basically have two problems:
1) The box is positioned at 100,200 as per style.php and NOT 100,500 .........my new variables
2) Since including the "link href="style.php.............etc at the top of the gettrains.php file it keeps reloading when previously it did not (Its part of an AJAX call (GET) that worked fine before including the LINK to style.php
Any help appreciated. Thanks