I have this (simple) code. I want to retrieve a random value from each array and then ask the user to tell me what the answer is when they've been multiplied.
The user arrives at this page after declaring their name on the previous page and their name arrives in a SESSION variable.
Nothing happens when this page is arrived at!! Nothing. Just a blank page...
I was doing something before without arrays (just using random numbers) and it worked fine. Now I have arrays... problems.
Here is the code:
<?php session_start(); ?>
<html>
<head>
<?php
$first=array(2,4,8,10);
$second=array(2,4,8,10);
$b=rand(0,3);
$c=rand(0,3);
$f=$first['$b'];
$s=$second=['$c'];
$d=$f*$s;
$score=$_SESSION["score"];
$name=$_SESSION["name"];
?>
</head>
<body>
<?php
echo $name." your score so far=".$score;
echo "<br>";
?>
<?php echo"Write the answer";?>
<br>
<?php echo $f."x".$s."=";?>
<form method= "post" action="submit.php">
<input type="number" name=a value="0">
<input type="hidden" name=b value=<?php echo $f;?>>
<input type="hidden" name=c value=<?php echo $s;?>>
<input type="submit" name=submit value="Go!">
</form>