I need to do up a form whereby once the user update a field it will display a set of textbox for user to fill in...
ie
In a form...
no.of ppl ( a drop-down list) values 1-10..
if i select no.of ppl to be 5 then there will be 5 input textbox appearing below for me to key in their email.....
if i select no. of ppl to be 6 then there will be 6 input textbox...
Can anyone tell me how to do this??
help in coding with forms
Moderator: General Moderators
-
fastfingertips
- Forum Contributor
- Posts: 242
- Joined: Sun Dec 28, 2003 1:40 am
- Contact:
You should ask this in the client side area because this is a JavaScript problem
.
viewforum.php?f=13
viewforum.php?f=13
call me old fashioned but...

Code: Select all
<?php
if(isset($_POST['go']))
{
$num = (int)$_POST['b'];
echo '<form method="POST" action="">';
for($x = 1; $x<=$num; $x++)
{
echo 'Email '.$x.': <input type="text" name="'.$x.'"><br />';
}
echo ' <input type="submit" value=" Go " name="go1"></form>';
}
else
{
echo '<form method="POST" action="">
Number of Boxes:<br />
<select name="b">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
</select> <input type="submit" value=" Go " name="go">
</form>';
}
?>