Jump to content

Form in a div


marf

Recommended Posts

I am currently wondering how to go about this.  I have lets say  index.php  with all kinds of divs and such. One of the divs, I have load signup.php within the div using XMLHTTPRequest. So that form shows up perfectly fine within my div. However what I'm wondering is, when they fill in the form and click Sign Up, I will of course do the necessary database insertions/confirmation e-mail, and I want it to Load a new page in the Div. What I'm wondering is do I have the <form> in signup.php do a post or get action, and will pressing submit cause the actual loading of a whole new page? because I don't want it to load a new page, I just want it to do the necessary php code and then return a value to the Div saying either (completed) or (error).  Anybody done anything similar to this?

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/54461-form-in-a-div/
Share on other sites

make the form tag only hav a method and not an action and have a form name and id, then you have a button instead of a submit, which will have an onclick event that calls a javascript function which will do your processing, and there is no need to do call a new page, the javascript will handle all your requests to the server and the php wil be seperate, and all you need to do there is get the responsetext, and fill the div which had the form with the thank you message received from php

Link to comment
https://forums.phpfreaks.com/topic/54461-form-in-a-div/#findComment-270651
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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