Page 1 of 1
help in coding with forms
Posted: Sun Jan 11, 2004 12:34 am
by dakkonz
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??
Posted: Sun Jan 11, 2004 5:53 am
by fastfingertips
You should ask this in the client side area because this is a JavaScript problem

.
viewforum.php?f=13
Posted: Sun Jan 11, 2004 6:58 am
by JAM
Moved to client side section.
Posted: Sun Jan 11, 2004 8:31 am
by qads
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>';
}
?>

Posted: Sun Jan 11, 2004 11:29 am
by JAM
Qads, you are right. Posting the form between passes is an option, so it should work. =)
It wasn't specified when the actual updating of fields would happen...