简体   繁体   中英

How can i use GET METHOD on wordpress plugin admin page

I am building a custom plugin which i plan to sell, but i am having problem storing my get request values in the plugin URL.

I have this URL:

/wp-admin/admin.php?page=step-one&filename=Styles_For_Less-Styles_For_Less_Product_Catalog.txt

and when the submit button on that page is clicked it should go to page with this URL:

/wp-admin/admin.php?page=step-two&filename=Styles_For_Less-Styles_For_Less_Product_Catalog.txt&header=0&delimiter=%7C&quoted=&step2=Step+2+%3E%3E

But i doesn't instead it goes here:

/wp-admin/admin.php?header=1&delimiter=%2C&quoted=&step2=Step+2+%3E%3E

<form method="GET" action="<?php echo admin_url( "admin.php?page=step-two&filename=$filename&", "http" ); ?>">
<table border="1" cellpadding="4">
    <tr>
        <td>Header Row:</td>
        <td><?php echo $header; ?> </td>
    </tr>
    <tr>
        <td>Delimiter:</td>
        <td><?php echo $delimiter; ?> </td>
    </tr>
    <tr>
        <td>Quoted:</td>
        <td><?php echo $quoted; ?> </td>
    </tr>
</table>
<p><input type="submit" value="Step 2 &gt;&gt;" name="step2">&nbsp;&nbsp;
<input type="reset" value="Reset" name="B2"></p>
</form>

Any help greatly appreciated.

Instead of appending data in the action url, try creating hidden form inputs.

<form method="GET" action="<?php echo admin_url( 'admin.php'); ?>">
<input type="hidden" name="page" value="step-two" />
<input type="hidden" name="filename" value="<?php echo $filename; ?>" />
<table border="1" cellpadding="4">
// ... rest of the form

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM