Textbox looping
Moderator: General Moderators
Textbox looping
I want to make like this. On my form, I just have 1 textbox for the 1st time. After this textbox has filled, when I press 'Enter', this form will submit and return back to this form. After return, 1 more textbox(empty) will be added onto this form and the previous textbox will display the value I've entered before submit. This process will continue so on. This mean, if I've press 'Enter' 10 times, this form should have 11 textboxes on it with the last textbox is empty. Anybody have the idea?
-
aleigh
- Forum Commoner
- Posts: 26
- Joined: Thu Mar 25, 2004 11:06 am
- Location: Midwestern United States
- Contact:
Re: Textbox looping
<?phpS_henry wrote:I want to make like this. On my form, I just have 1 textbox for the 1st time. After this textbox has filled, when I press 'Enter', this form will submit and return back to this form. After return, 1 more textbox(empty) will be added onto this form and the previous textbox will display the value I've entered before submit. This process will continue so on. This mean, if I've press 'Enter' 10 times, this form should have 11 textboxes on it with the last textbox is empty. Anybody have the idea?
if(!$_POST['count'])
$count=1;
else
$count=$_POST['count'];
print '<FORM ACTION="test.php" METHOD=POST>
<INPUT TYPE="HIDDEN" NAME="count" VALUE="'.($count+1).'">';
for($i=0;$i<$count;$i++)
print '<INPUT NAME="'.$i.'" VALUE="'.$_POST["$i"].'"><P>';
print '<INPUT TYPE="SUBMIT"></FORM>';
?>
I hope I, er, you get a good grade.