I am incrementing a value of a hidden element using javascript , and posting it in the $_POST array. But it increases only once , and then remains the same. Please help.
My file is incrementing.php with the 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>