wubwubwub Posted July 16, 2012 Share Posted July 16, 2012 Hello guys. I'm bothering you today with a newbie question: Is it possible, after clicking the "submit" button, not to launch a new php file (the file specified in the "action" attribute) but rather load it in a central div (which previously displayed the form) ? Something like: [form contained within a div] -> complete form -> submit -> load the file that handles the input values and MySQL storage -> do not open that new file in the browser but display it in the div. Thanks in advance. Link to comment https://forums.phpfreaks.com/topic/265786-php-form-question/ Share on other sites More sharing options...
KevinM1 Posted July 16, 2012 Share Posted July 16, 2012 Of course. Just have the form submit to itself, then handle it with PHP on the refresh. Pseudocode: if (/* form has been submitted */) { /* Get a hold of the form data * Do what you need to do with the database * Output success/failure depending on whether the form values were legit */ } else { /* first time at this script, show the form */ } Link to comment https://forums.phpfreaks.com/topic/265786-php-form-question/#findComment-1361994 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.