Skip to main content
HTML form was invisible (and some other details because I needed 6 non-space chars)
Source Link

I'm looking for a simple way for a Wordpress plugin to process $_POST$_POST data from a user submitted form. Back end processing will be performed and then I'll redirect to a new page as appropriate - so during processing there is no UI.

Basically, I want to take a form submit such as...

'; ...and process it like I would with PHP but still be able to use WP's "nonce" protection.
   <form method="post" action="/back-end-processing.php">
     <input type="text" name="text" />
     <input type="submit" value="submit" />
   </form>';

...and process it like I would with PHP but still be able to use WP's "nonce" protection.

Some examples I've seen suggest that I should use admin-post.php but I was concerned that it should only be used for actual admins and not for general users.

Another approach suggested...

function checkCheckBox()
{
    if($_POST['checkbox'] == 1)
    {
       return true;
    }

    return false;
}

add_action('init', 'checkCheckBox');

...however, this seems like overkill because it will be called for every page while my site visitors will only be $_POST'ingposting data to it infrequently.

I'm looking for a simple way for a Wordpress plugin to process $_POST data from a user submitted form. Back end processing will be performed and then I'll redirect to a new page as appropriate - so during processing there is no UI.

Basically, I want to take a form submit such as...

'; ...and process it like I would with PHP but still be able to use WP's "nonce" protection.

Some examples I've seen suggest that I should use admin-post.php but I was concerned that it should only be used for actual admins and not for general users.

Another approach suggested...

function checkCheckBox()
{
    if($_POST['checkbox'] == 1)
    {
       return true;
    }

    return false;
}

add_action('init', 'checkCheckBox');

...however, this seems like overkill because it will be called for every page while my site visitors will only be $_POST'ing data to it infrequently.

I'm looking for a simple way for a Wordpress plugin to process $_POST data from a user submitted form. Back end processing will be performed and then I'll redirect to a new page as appropriate so during processing there is no UI.

Basically, I want to take a form submit such as...

   <form method="post" action="/back-end-processing.php">
     <input type="text" name="text" />
     <input type="submit" value="submit" />
   </form>';

...and process it like I would with PHP but still be able to use WP's "nonce" protection.

Some examples I've seen suggest that I should use admin-post.php but I was concerned that it should only be used for actual admins and not for general users.

Another approach suggested...

function checkCheckBox()
{
    if($_POST['checkbox'] == 1)
    {
       return true;
    }

    return false;
}

add_action('init', 'checkCheckBox');

...however, this seems like overkill because it will be called for every page while my site visitors will only be posting data to it infrequently.

Source Link
Ken K
  • 21
  • 1
  • 2

Looking for a simple approach for handling user $_POST data without AJAX?

I'm looking for a simple way for a Wordpress plugin to process $_POST data from a user submitted form. Back end processing will be performed and then I'll redirect to a new page as appropriate - so during processing there is no UI.

Basically, I want to take a form submit such as...

'; ...and process it like I would with PHP but still be able to use WP's "nonce" protection.

Some examples I've seen suggest that I should use admin-post.php but I was concerned that it should only be used for actual admins and not for general users.

Another approach suggested...

function checkCheckBox()
{
    if($_POST['checkbox'] == 1)
    {
       return true;
    }

    return false;
}

add_action('init', 'checkCheckBox');

...however, this seems like overkill because it will be called for every page while my site visitors will only be $_POST'ing data to it infrequently.