I have a form whose elements are created dynamically on selection, i.e. the form has only text boxes and the number of text boxes depends on the users selection, if user selects 3 then 3 dynamic text boxes are created and if user selects 4 then 4 dynamic text boxes are created and so on. Here is the code I am using to dynamically create the text boxes:
Expand|Select|Wrap|Line Numbers
- echo ("<form name='exam' action='exam_2.php' method='POST'>");
- for ($j=0;$j<sizeof($namearr);$j++){
- echo ("<tr>");
- echo ("<td>".$namearr[$j]."</td>");
- echo ("<td>");
- echo ("<input type='text' name='element' size='8'>");
- echo ("</td>");
- }
- echo ("<input type='submit' name='exam_sub' value='submit'>");
- echo ("</form>");
Expand|Select|Wrap|Line Numbers
- $element = $_POST['element'];
- echo $element;
Any help is greatly appreciated. Please give me some suggestions or coding examples.
With regards,
gubbachchi