0

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....

3
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by diafol
0

better use JQuery.
Write select box elements and use unique ID as well as value.

and use

$("#IDValue").change(funtion(){
// here write code for open or close new form.
});
0

As mentioned this can be achieved via js (jQuery) only. No need for php unless the form to be shown needs some specific processing, e.g. extract data from DB before display.

0

Coming back to this:

You could avoid Ajax totally if your forms are not dynamic. Just hide all the forms with css (e.g. class="hide" with the css rules to go with it), then your onselect attribute for the select field decides to hide all subforms then just show the one you want. Alternatively, you could store your forms in javascript and have them show in a <div>.

Personally, I'd use Ajax (jQuery flavour) - onselect calls a js function, with a parameter. The js function passes this to a php script via Ajax object, the html is passed back via Ajax response and finally js updates the <div> with the new content.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.