I am trying to get a form in which you fill in a text field and press update and the form is redrawn with that text field and a new one to enter another string in. I'm using $PHPSELF to call the same script agian but I can't get the data to persist through iterations.
Here is the test code I'm working with:
echo "<form action=\"$PHPSELF\" method=\"POST\">\n";
if ($been_viewed){
$i = 0;
echo "count: $count<br>";
while ($i < $count) {
echo "<input type=\"text\" value=\"$string[$i]\"><br>\n";
$i++;
}
echo "Enter String: <input type=\"text\" name=\"$string[$count]\">\n";
echo "<input type=\"hidden\" name=\"been_viewed\" value=\"$been_viewed\">\n";
$count = $count + 1;
echo "<input type=\"hidden\" name=\"count\" value=\"$count\">\n";
echo "<input name=\"Update\" value=\"Update\" type=\"submit\">\n";
echo "</form>\n";
} else {
$been_viewed = 1;
$count = 1;
echo "Enter String: <input type=\"text\" name=\"string[]\">\n";
echo "<input type=\"hidden\" name=\"been_viewed\" value=\"$been_viewed\">\n";
echo "<input type=\"hidden\" name=\"count\" value=\"$count\">\n";
echo "<input name=\"Update\" value=\"Update\" type=\"submit\">\n";
echo "</form>\n";
}