I’m currently making a wordpress plugin with a settings page, where the user can input images, names and URL’s which will then be shown on the website using a widget and a shortcode. Of course, I want to save these settings so they can be shown on the website.
I have found this code, but I don’t know if it is the (best) way:
<form method="post" action="options.php">
<?php wp_nonce_field('update-options') ?>
<p><strong>One 1:</strong><br />
<input type="text" placeholder="Name" name="name" size="45" value="<?php echo get_option('name'); ?>" />
<input type="text" placeholder="Logo" name="logo" size="45" value="<?php echo get_option('logo'); ?>" />
<input type="text" placeholder="Website" name="website" size="45" value="<?php echo get_option('website'); ?>" />
</p>
<input type="submit" name="Submit" value="Save" /></p>
<input type="hidden" name="action" value="update" />
<input type="hidden" name="page_options" value="name, logo, website" />
</form>
What do you suggest?
read the Settings API from WordPress, there is all you need to create an option page.