rendered paste body<?php/** * @author alihammad * @copyright 2007 */ // 1st step to choose the form elementsfunction first() { echo "<h2>First step</h2><br><br>"; echo "Please choose the elements you want your form to have from below<br>";?><form action="function_generate_form.php" method='POST'><input type="checkbox" name="textfield">Text Fields<br><input type='checkbox' name='checkbox'>Check Boxes<br><input type='checkbox' name='radiobutton'>Radio Buttons<br><input type='checkbox' name="list">Lists<br><input type='checkbox' name='textarea'>Text Areas<br><input type="submit" value="Goto 2nd Step" name='sub' style="float: right;"></form><?}//2nd step is to choose the quantity for each elementfunction second() { echo "<h2>Second step</h2><br><br>"; echo "Please specify the quantity for each element<br>"; echo "<form action='function_generate_form.php' method='POST'>"; if( isset($_POST['textfield'])) { echo "How many text fields: <input type='text' name='t_quantity'><br>"; } if(isset($_POST['checkbox'])) { echo "How many check boxes: <input type='text' name='c_quantity'><br>"; } if(isset($_POST['radiobutton'])) { echo "How many Radio buttons: <input type='text' name='r_quantity'><br>"; } if( isset($_POST['list'])) { echo "How many Lists: <input type='text' name='l_quantity><br>"; } if( isset($_POST['textarea'])) { echo "How many Text areas: <input type='text' name='ta_quantity'><br>"; } echo "<iput type='submit' name='sub' value='Goto 3rd Step'>"; echo "</form>";}//take namesfunction third() { echo "<h2>Third step</h2><br><br>"; echo "Please insert the names for each field<br>"; echo "<form action='function_generate_form.php' method='POST'>"; if (isset($_POST['t_quantity'])) { echo "Names for text fields<br>"; for($i=1; $i<=$_POST['t_quantity']; $i++) { echo "Text field ".$i.": <ipnut type='text' name='t_names_".$i."'><br>"; } echo "<input type='hidden' name='t_quantity' value='".$_POST['t_quantity']."'>"; } if(isset($_POST['c_quantity'])) { echo "<hr>Names and question for check boxes<br>"; echo "Check boxes heading or question: <input type='text' name='c_head'><br>"; for($i=1; $i<= (int) $_POST['c_quantity']; $i++) { echo "checkbox ".$i.": <input type='text' name='c_names_".$i."'><br>"; } echo "<input type='hidden' value='".$_POST['c_quantity']."' name='c_quantity'>"; } if(isset($_POST['r_quantity'])) { echo "<hr>Names and question/heading for radio buttons<br>"; echo "Radio buttons heading or question: <input type='text' name='r_head'><br>"; for($i=1; $i<= (int) $_POST['r_quantity']; $i++) { echo "Radio button ".$i.": <input type='text' name='r_names_".$i."'><br>"; } echo "<input type='hidden' name='r_quantity' value='".$_POST['r_quantity']."'>"; } if(isset($_POST['l_quantity'])) { echo "<hr>Heading and names for the lists elements<br>"; for($i=1; $i<= (int) $_POST['l_quantity']; $i++) { echo "List no".$i." heading/ quantion/ name: <input type='text' name='list_heads_".$i."'><br>"; echo "List elements: <input type='text' name='l_names_".$i."'>"; echo "(separate each element with comma)<br>"; } echo "<input type='hidden' name='l_quantity' value='".$_POST['quantity']."'>"; } if(isset($_POST['ta_quantity'])) { echo "<hr>Names for the text areas<br>"; for ($i=1; $i<= (int) $_POST['ta_quantity']; $i++) { echo "Text area ".$i.": <input type='text' name='ta_names_".$i."'><br>"; } echo "<input type='hidden' name='ta_quantity' value='".$_POST['quantity']."'>"; } }function main(){ if(isset($_POST['sub'])) { switch ($_POST['sub']) { case "Goto 2nd step"; second(); break; case "Goto 3rd step"; third(); break; case "Create Form"; create(); break; case "submit"; sub(); break; Default; echo "Invalid value"; break; } } else first();}main();