I want to increment variable in html .. the variable is declared in php and I need to increment it in php ... I write the code bellow :
global $indice_array_contact;
$indice_array_contact=0;
<img src="images/back1.png" onclick='left_clik()'>
<img src="images/back2.png" onclick='right_clik()'>
<SCRIPT LANGUAGE="JavaScript">
<?php $indice_array_contact=$indice_array_contact+1; ?>
function left_clik()
{ document.getElementById("im1").src = "profiles_stored/executive.png";
document.getElementById("td1").innerHTML = "<?php echo $indice_array_contact ?>";
<?php $indice_array_contact=$indice_array_contact+1; ?>
}
function right_clik()
{ document.getElementById("im1").src = "profiles_stored/<?php echo $array_contact[0]->profile ?>";
document.getElementById("td1").innerHTML = "<?php echo $indice_array_contact ?>";
<?php $indice_array_contact=$indice_array_contact+1; ?>
}
When I click on the right_click button , the value is 1 ,and when I click on the left_click button , the value is 2 ... but if I click second time on right_click button the value doesn't change to 3. Why?
<script type="text/javascript">