Incrementing a value using javascript and php and saving it in POST array -


i incrementing value of hidden element using javascript , , posting in $_post array. increases once , , remains same. please help.

my file incrementing.php below code:

<script language="javascript">  function nextclicked() {    document.getelementbyid("labelclicked").value =    document.getelementbyid("labelclicked").value + 1 ;    document.forms["incrementing"].submit();  } </script>   <?php  if(isset($_post['labelclicked']) && $_post['labelclicked']>=1) {   $_post['labelclicked'] = $_post['labelclicked'] +9;   }  ?> <?php     if(isset($_post['clickednext']))     {         echo 'value ='.$_post['labelclicked'];     }     else     {         echo "not clicked yet";     }    ?> <form name = "incrementing" method="post" action="incrementing.php">  <div class=d2 align=left><a href="#" onclick=" nextclicked(); submit();">next</a> <input type = "hidden"  id="labelclicked" name="labelclicked" /> </form> 

don't need set value of labelclicked id new, incremented value is?

<input type="hidden"  id="labelclicked" name="labelclicked" value="<?php echo $_post['labelclicked']; ?>" /> 

otherwise incrementing "" everytime. should make sure treating

document.getelementbyid("labelclicked").value 

as integer , not string, or else "111111"


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -