1

Ok, so I have a table in my admin area for my plugin. Each row as an edit button, which should post to the edit page. I don't know how to add my php edit page to the registered wordpress page, though, so I don't know what to put for action in the form.

        <td><form action="[edit.php]" method="post">
                <input type="hidden" id="<?php echo $issue->id?>" name="id" value="1">
                <input type="submit" value="Edit">
            </form>
        </td>

So what should I put inside the brackets (and yes, I will remove the brackets), and where/how do I add edit.php so wordpress knows it exists?

UPDATE: So apparently I just add edit.php normally, but specify null for its parent. Stil no idea what to put in those brackets.

UPDATE 2: Apparently the function I was looking for was menu_page_url...

1 Answer 1

0
    <td><form action="<?php menu_page_url('edit') ?>" method="post">
            <input type="hidden" id="<?php echo $issue->id?>" name="id" value="1">
            <input type="submit" value="Edit">
        </form>
    </td>

Then, in the function where you add your admin pages:

    add_submenu_page( null, 'edit', 'Edit', $capability, 'edit', 'create_edit');

Also add this function:

function create_edit(){
    include 'edit.php';
}

It would probably be a good thing to have more unique names than these.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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