editing html with embedded PHP using javascript -


i hope has answer me,

i trying create php product page shop website, have sql table stores name of image prefix eg if image file 'test_1.png' table stores 'test'. using embedded php

src="images/shop/<?php echo $row['item_img'], '_1.png';?>"></img> 

what using js, dynamically update src on mouse click.

something eg.

var imgswitch = function(i){   document.getelementbyid('js-img').src = "images/shop/     <?php echo $row['item_img'], '_';?>i<?php echo '.png';?>"; } 

even me seems wrong why i've turned guru's here

is there anyway possible? if not, suggestions appreciated

i trying figure out asking, , think way go:

var imgswitch = function(i){   document.getelementbyid('js-img').src = "images/shop/<?php echo $row['item_img'], '_';?>" + + ".png"; } 

the change in i, have cut string , add variable.

but remember php code executed @ server, , not change once page sent client. when execute function, $row['item_img'] same.


Comments

Popular posts from this blog

dns - How To Use Custom Nameserver On Free Cloudflare? -

python - Pygame screen.blit not working -

c# - Web API response xml language -