Hello DaniWeb.
It's my first time to do PHP, so please bear with me.
I've read books and viewed tutorials just to solve this one.
I want to have a variable number of text fields. Then, I want to have the contents of those text fields loaded in an array in &_POST, because I want to be able to use those values as an array in the next page.
How do I implement that?
I tried this one, but it doesn't work:
<?php
$n = $_POST["var_n"];
?>
<html>
<body>
<br>
<center><h2>Reverse Array</h2></center>
<form action="Result.php", method="post">
<center>
<br>Please input the contents of the array:
<br>
<?php
$the_array = array_fill(0, $n, 1);
createTextBoxes($the_array, $n);
//$array_ref = array_fill(0, $n, 1);
?>
<br><input type="submit" value="Next">
</center>
</form>
</body>
</html>
<?php
function createTextBoxes($the_array, $n){
for($i = 0; $i < $n; $i++)
echo "<input type=\"text\" name=\"\$the_array[", $i, "]\" size=\"3\">";
}
?>