Jump to content

PHP form question


wubwubwub

Recommended Posts

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

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

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.