i have quizaction.php page and result.php page. I am passing variables from quizaction.php to result.php. this is my quizaction.php:
<?php
include 'db.php';
session_start();
?>
<html>
<head><title>Quiz Feedback</title></head>
<body bgcolor="#FFFFFF">
<form name="result" action=result.php method="POST">
<?php
$_SESSION['time_left'] = $_POST['formvar'];
$_SESSION['time_taken'] = 60 - $_SESSION['time_left'];
?>
<INPUT TYPE="SUBMIT" VALUE="Done" >
</form>
</body>
</html>
and my result.php is:
<?php
session_start();
include 'db.php';
include 'quizaction.php';
?>
<button onclick="myFunction()">Try it</button>
<script type="text/javascript">
function myFunction() {
var topic1= "<?php echo $type[0]; ?>";
var topic2= "<?php echo $type[1]; ?>";
var score= "<?php echo ($score); ?>";
alert("check");
alert(score);
alert(topic1);
alert(topic2);
}
</script>
but im unable to retrieve value of score from quizaction.php. Actually im getting data in quizaction.php also from other page. But here i dont think there is any problem with that. Please help me out. Even expatiation will work