Admin Plugin POST to another file within the plugin

This is a simplified version of what I need to do (i.e. I know there are other ways of doing things but I need a solution to this specific problem). I am using wordpress 3.3 from a fresh install.

I have a plugin and I have added it to the admin menu:

Read More
add_menu_page('Plugin','Plugin', 'edit_pages', 'plugin/page1.php');

which works fine, I can click on it it takes me to:

admin.php?page=plugin/page1.php

plugin/page1.php has a form on it:

<form action="admin.php?page=plugin/page2.php">

When I submit the form however I get a “You do not have sufficient permissions to access this page.” page

If I add plugin/page2.php as an menu or submenu item then i can submit to it with no problems. If i set the action of the form to be admin.php?page=plugin/page1.php the form submits fine also.

My question is how do I get this to work? I suspect I have to register some thing somewhere I just have no idea what and searching has yielded nothing.

Related posts

Leave a Reply

1 comment