Jump to content

Archived

This topic is now archived and is closed to further replies.

betaone

show #of forms as requested in dropdown

Recommended Posts

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.