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