set php variable as x,y location of image in html -


i trying set x , y of image in html value of php variables coordinate in loop image drawn 5 times in row. if figure out how set left: $x great

<?php  for($i=0; $i<5; $i++){ $counter = 0; $x = 200; echo '<img src="stat.png" height="300" width="150"style="position: absolute; top:    10px; left: <?php echo $x; ?> px;"/>'; // above trying use php variable $x += 200; }  ?> 

two things: weren't doing concatenation correctly $x, , redefined $x = 200 @ every iteration rather set original value. see below

<?php $x = 200;  for($i=0; $i<5; $i++){ $counter = 0; echo '<img src="stat.png" height="300" width="150"style="position: absolute; top: 10px; left:'.$x.'px;"/> '; // above trying use php variable $x += 200; }  ?> 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -