I'm a beginner at coding, and I have to make a small game in php for school. I have to use a hidden input, like this:
<form action="process.php" method="post">
<input type="hidden" name="rand" value="<?php rand(1,10); ?>" />
</form>
The value stands for a random number between 1 and 10 (I hope the value is correct). Now, in process.php I want to retrieve the random number by using post, so what I tried to do is the following:
<?php $random = $_POST['rand'];
echo $random; ?>
In my browser (Firefox), I'm getting the following error:
Notice: Undefined index: rand in G:\xampp\htdocs\process.php on line 2
Does anyone know how I can echo the hidden value without using complex techniques?
Thanks in advance, Maxime