0

I have this basic admin page

functions.php

<?php include('ui.php'); ?>

ui.php

<?php
function gui()
{
    include('gui.php');
}
function add_page()
{
    $themename = 'Cesaro';
    $page_function = 'gui';
    add_menu_page( $themename." Options", $themename, 'edit_themes', $page_function, 'gui' );
}
add_action( 'admin_menu', 'add_page' );
?>

gui.php

<form name="input" action="post_options_from_form.php" method="post">
    <article>
        <label>Firstname</label><input type="text" class="x-input"/>
    </article>
    <article>
        <label>Lastname</label><input type="text" class="x-input"/>
    </article>
    <article>
        <label>City</label><input type="text" class="x-input"/>
    </article>
    <input type="submit" value="Update Options" class="x-button"/>
</form>

When i click update options,i get the error

The requested URL /wp-admin/post_options_from_form.php was not found on this server.

How do i make sure that post values end up my php i specified in the post action?.My post php file is post_options_from_form.php

0

I solved it this way

<form name="input" action="<?php echo get_bloginfo( 'template_directory' ).'/'.'post_options_from_form.php'; ?>" method="post">

although i wanted post_options_from_form.php to be an admin page.

Edit:

This finally worked as i was able to post to the admin page i created

<form name="input" action="admin.php?page=admin_page" method="post">

On the function,

function admin_page()
{
require('post_options_from_form.php');
}
2
  • Just using <form name="input" method="post"> is enough. – RRikesh Jul 26 '12 at 9:31
  • No its not enough. – Gandalf Jul 26 '12 at 14:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.