Below is my code:
index.php file
javascript of index.php file
function Result()
{
var marks = 55;
document.getElementById("hdnmarks").innerHTML= marks;
window.location = "results.php";
}
HTML of index.php
<input type="hidden" name="hdnmarks" id="hdnmarks">
Description: I have a web page with url localhost/index.php. In index.php, I have a submit button on the click of which I call Result javascript method which sets the marks = 55 and put it into the hidden field and takes me to the results.php page.
In results.php, I have to insert value of marks in the database. But how should I access the marks as those were stored in the hidden field of index.php file?
I want to put marks in the session, but how should I maintain the PHP session in javascript function? I mean where and when should I put marks in the session before moving to results.php?