lamboman Posted May 30, 2011 Share Posted May 30, 2011 I have 3 images Shown below. What I want to do is add an onclick that will change another variable (lets call it $secondary). So when any one of these are clicked it will change the variable $secondary to whatever I want it to be. (hope that makes sence) <?php $main[0]="<img src='images/00.gif'>"; echo $main[0]; ?> <?php $main[1]="<img src='images/01.gif'>"; echo $main[1]; ?> <?php $main[2]="<img src='images/02.gif'>"; echo $main[2]; ?> Link to comment https://forums.phpfreaks.com/topic/237879-varable-change-with-onclick/ Share on other sites More sharing options...
mikesta707 Posted May 30, 2011 Share Posted May 30, 2011 onclick is a client side event caught by client side languages like javascript. PHP can't do anything with an onclick event. Link to comment https://forums.phpfreaks.com/topic/237879-varable-change-with-onclick/#findComment-1222382 Share on other sites More sharing options...
lamboman Posted May 30, 2011 Author Share Posted May 30, 2011 I figured as much, thanks Link to comment https://forums.phpfreaks.com/topic/237879-varable-change-with-onclick/#findComment-1222385 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.