I am making an osclass plugin. I have added a page for my plugin in the admin section of the site. I have also created a route for my plugin.
What I would like to do is create a form on my plugin's page in the admin. The action attribute of this form will be the base url of my custom route. The form will then add a query string of parameters to the base url when the administrator submits it. Specifically, the query string should include an id parameter, for example ?id=1
.
Here is what I have:
<form action="<?php echo osc_route_admin_url('my-custom-route'); ?>" method="get">
<h2>User Profile form</h2>
<select name="id">
//...options, each one's value is a registered user
</select>
<input type="submit" value="Submit">
</form>
I have tested this form. Instead of dropping me off at my custom route url, osclass redirects me to the url of the admin dashboard (with the correct id included in the query string along with an octoken). I need it to trigger my custom route.
I have tested the custom route by printing a link to it on the same page where the form is. When accessed by clicking the link, the custom route works fine.
Thanks to anyone who can help!