help in coding with forms

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
dakkonz
Forum Commoner
Posts: 69
Joined: Sat Dec 27, 2003 2:55 am
Location: Asia

help in coding with forms

Post 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??
fastfingertips
Forum Contributor
Posts: 242
Joined: Sun Dec 28, 2003 1:40 am
Contact:

Post by fastfingertips »

You should ask this in the client side area because this is a JavaScript problem :).

viewforum.php?f=13
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post by JAM »

Moved to client side section.
qads
DevNet Resident
Posts: 1199
Joined: Tue Apr 23, 2002 10:02 am
Location: Brisbane

Post 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>';
}
?>
:D
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post 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...
Post Reply