is it possible to pass through $_POST or $_GET an array, with values in it, without using serialize() and unserialize() ? here is an example code, trying to find a number..i entered value 4 instead of rand, just to do the testing.. i thought of the potential of using a foreach to make multiple input hidden, in case i could pass all variables every single time, but it seems not to be working.. any ideas..??? or it is just not possible without serializing?
<?php
$x = $_POST['x'];
$Num = $_POST['Num'];
$first_name[] = $_POST['first_name'];
if (!$x)
{
Echo "Please Choose a Number 1-100 <p>";
$x = 4; //rand (1,4) ;
}
else {
if ($Num >$x)
{Echo "Your number, $Num, is too high. Please try again<p>";}
elseif ($Num == $x)
{Echo "Congratulations you have won!<p>";
Echo "To play again, please Choose a Number 1-100 <p>";
$x = 4;// rand (1,4) ;
}
else
{Echo "Your number, $Num, is too low. Please try again<p>";}
}
?>
<form action = "<?php echo $_SERVER['PHP_SELF']; ?>" method = "post"> <p>
Your Guess:<input name="Num" />
<input type = "submit" name = "Guess"/> <p>
<input type = "hidden" name = "x" value=<?php echo $x ?>>
<?php
foreach($first_name as $val){
echo "<input type=\"hidden\" name=\"first_name[]\" value=$val />";
}
?>
</form>
</body>
</html>