• This seems like a stupid question but I’m drawing a blank.

    After I submit a form I want

    admin.php?page=edit_listings&action=edit&list=4

    to become

    admin.php?page=edit_listings

    I don’t even know if what I’m doing is the correct way but thats another story. If you don’t mind taking a look here’s what I’m trying to do:

    I am using WP_List_table to display items from a table in the database. When I press edit on an item I want the list to disappear and my edit fields to show. Then when I press the update button I want my edit fields to disappear and the list of items to reappear.

    Here’s my code:

    [code moderated – use the pastebin for any code over the forum limit of 10 lines – see forum guidelines]

Viewing 2 replies - 1 through 2 (of 2 total)
  • if ($_REQUEST['action'] == 'save') {
    // save the form
       echo '<meta http-equiv="refresh" content="0;url=admin.php?page=edit_listings&saved=true">';
       die();
    }

    of course $_REQUEST[‘action’] is what I set when I submit a form, you can adjust it accordingly. Additionally, I pass saved=true so I can display a div that says “Saved successfully” on the page, but that isn’t necessary

    Thread Starter kfuchs

    (@kfuchs)

    Thanks for the help, I realized another way to do it. If anyone comes across googling this here is how I did it:

    I use str_replace() to replace the ‘action=edit’ into ‘action=saved’

    I create two arrays:

    $to_replace = array('%7E','action=edit');
    $replace_with = array('~','action=saved');

    then in my html form I use:

    <form name="culis_edit_item_form" action="<?php echo str_replace( $to_replace, $replace_with, $_SERVER['REQUEST_URI']); ?>" method="post">
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Stupid problem with adim.php?page=’ is closed to new replies.