mihirpatel83 Posted December 24, 2010 Share Posted December 24, 2010 Hello everyone, I am new to PHP to so please bear with me. I need suggestion to achieve a task. I have to make a form where in initially there will be a combox box. Depending onthe selection ie value1, value2, value3 etc.......a sub form should open below the combo box. This forms r different for different value...and at the end there will be a submit button to submit the form. Can anyone tell me the how many ways this is possible and which is the efficient one.??? Thanks a lot in advance.... Link to comment https://forums.phpfreaks.com/topic/222568-combo-box-on-click-suggestion/ Share on other sites More sharing options...
the182guy Posted December 24, 2010 Share Posted December 24, 2010 Here's a quick example: <html> <body> <script type="text/javascript"> function showForm(formName) { if(formName.length > 0) { document.forms["form1"].style.display = "none"; document.forms["form2"].style.display = "none"; document.forms["form3"].style.display = "none"; document.forms[formName].style.display = ""; } } </script> <select onchange="showForm(this.value)"> <option value="">Select a form...</option> <option value="form1">Form 1</option> <option value="form2">Form 2</option> <option value="form3">Form 3</option> </select> <form name="form1" style="display:none;"> form1: <input type="hidden" name="selected_form" value="form1"> <input type="text" name="test1" /><br /> <input type="submit" value="Submit 1" /> </form> <form name="form2" style="display:none;"> form2: <input type="hidden" name="selected_form" value="form2"> <input type="text" name="test2" /><br /> <input type="submit" value="Submit 2" /> </form> <form name="form3" style="display:none;"> form3: <input type="hidden" name="selected_form" value="form3"> <input type="text" name="test3" /><br /> <input type="submit" value="Submit 3" /> </form> </body> </html> Link to comment https://forums.phpfreaks.com/topic/222568-combo-box-on-click-suggestion/#findComment-1151213 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.