Jump to content

using php to switch between forms


skylab001

Recommended Posts

Hello-

I am a beginner here and probably trying something beyond what I can possibly do but, I am trying to figure out how to set-up a page that would allow me to have a drop down menu that selects between two options, and then have one of two forms(based on the option selected in the dropdown) display on the page.  How complicated would this be? I was thinking of incorporating a javascript onChange with a php require, but when I started to work it out I confused myself more because I don't know javascript. So I'm back to hoping I can do this with php?

Link to comment
Share on other sites

You most certainly can do this with PHP only. The only thing is it will require a page refresh.

 

You will simply make your drop down menu with the options you want. Then use an if statement once the submit button is hit to determine which form to use.

 

If you want it to happen without a page refresh, then AJAX or plain javascript will be necessary.

 

Nate

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.