I have an option screen for my plugin, it's just a simple form.
<div class="wrap">
<h2>SoundCloud Podcast Importer Options</h2>
<hr/>
<h2>Add a show</h2>
<form method="post" action="../wp-content/plugins/SCImp-Pro/scimp_add_feed.php">
<p>Feed URL: <input type="text" name="scimp_feed_url" /></p>
<p>Show Category: <select name="scimp_show_category">
<?php
$categories=get_categories();
foreach ($categories as $category) { ?>
<option value="<?php echo $category->name; ?>"><?php echo $category->name; ?></option>
<?php } ?>
</select></p>
<?php submit_button(); ?>
</form>
</div>
As you can see, I take the form data, and send it to a php script, which adds it to the database using $wpdb. It looks like this:
<html>
<body>
<?php
require_once('../../../wp-config.php');
require_once('../../../wp-load.php');
global $wpdb;
$feedurl=$_POST['scimp_feed_url'];
$showcategory=$_POST['scimp_show_category'];
$table_name = $wpdb->prefix . 'scimp';
$wpdb->insert( $table_name, array('feedurl' => $feedurl, 'category' => $showcategory));
?>
</body>
</html>
Everything is working just fine so far. However, when the script has added the data to the database, I want to end up on the original options page I started at. I intend to add some code to the options page that will display what's in the database table, I just don't know how to take a user back there.
Is this something I could do with Javascript? Maybe the script could be run without taking the user away from the options page at all? I'm learning as I go, but I know next to nothing about what I can do with AJAX and Javascript.