Jump to content


Photo

show #of forms as requested in dropdown


  • Please log in to reply
1 reply to this topic

#1 betaone

betaone
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 19 June 2004 - 05:13 AM

well im VERY new to php and im starting small and hopefully going to end up with a cms;
back to the question (i do realize that my coding will be very incorect but since im realy new to this , newer then you could possibly imagine bare with me)

lets say i want the person that is submiting something to have the option to select the number of text forms they might need
wouldent you go about this by creating a drop down calling it like name=numb[] then have lets say 8 variables (1-8 for the dropdown selection)

they pick 4 and in the php code you would do

<select name="numb[]">
<option value="1">1
<option value="2">2
<option value="3">3
<option value="4">4
<option value="5">5
<option value="6">6
<option value="7">7
<option value="8">8
</select>

<form name="form1" method="post" action="">


<br>
<br>
Character Name:<br>
<input name="name" type="text" size="30" maxlength="30">
<br>
Character Biography<br>
:
<textarea cols=30 rows=10 name="bio"></textarea>
<br>
<input type="submit" name="submit" value="submit">
<br>
<br>
<table width="33%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<?php
$blah=
$name=$_POST['name'];
$bio=$_POST['bio'];

if(isset($name) && isset($bio)){
echo $name. ": " .$bio;
}
?>
</td>
</tr>
</table>
</form>

<?
$numb=count['numb[]'];
$form=$_request['numb[]+form1']
if ($numb);
then (show $numb of $form);
echo then;
}

?>



PS: i also have little to no clue as to what i was trying to do in that little piece of code :rolleyes:

for the best thingi have done in php so far go look at www.addpower.com/betaone/test.php (the dropdown is usless rightnow just put in something in first line and a discription about it in second text box) i also dont have a clue what isset is that iused a friend said that was better to use then the if($submit)
echo "$name:$bio"


www.addpower.com/betaone/test.phps.txt for code
Summer is here and i have hopes that before school starts i will understand PHP and MYSQL well enough to develope a CMS script , hopefully you guys will aid me along the journy!

#2 morpheus.100

morpheus.100
  • Members
  • PipPipPip
  • Advanced Member
  • 145 posts

Posted 20 July 2004 - 10:21 PM

You need to write a loop based on the $_POST value sent to the form. The post value should be the amount of times the loop will run. It is easy, so search tutorials for looping. I would post code but that would be too easy.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users