WordPress Admin/Plugin Form Submit Conventions

I have created a plugin, its adds an admin menu page for the menu. The page contains a form.

What I want to know is what is the suggested convention/method of handling form submissions.

Read More
  1. Should I load the page and in that check for the $_POST ?
  2. Should I load a separate form page ?

Thanks.

DETAILS:
The thought behind is:
I would want to load a new page and have my submit code it in, but would want to follow convention and the login/rules of capabilities.

(moved into wordpress.stackexchange.com)

Related posts

Leave a Reply

1 comment

  1. You can use a form page into your plugin and when you load the page you check the $_POST like this

    //At the page load
    if( isset( $_POST["MyForm"]))
    {
        action();
    }
    
    //The Form
    <form name="MyForm" method="POST" action="">
    </form>
    

    To load the new page if you have submit you have 2 solutions, in the “action()” you generate another page via PHP or you redirect to the other page you want but you have to register it to WordPress unless you’ll have an access denied.

    Personnaly i suggest to generate your page into your plugin.