How do I save data from submitted form from widget

I’m looking over internet for some simple solution of email subscription widget but no luck.

Or they are too complicated and paid, or they are relaying on some external email functions.

I’m not a WordPress expert but know few things about WordPress.

I would like to make form in widget where user enter their email address and address is written in wp database, and in back-end admin just list all emails and can select to delete email from subscribed list.

When making my own widget I know how to create widget and form, I know how to add admin page and list files from database.

What I don’t know is where and how to save data from submitted form from widget.

If anyone have any suggestion or widget that can do this please share it. In mean time I will search for solution.

3 Answers
3

This is what you’re looking for: http://codex.wordpress.org/Plugin_API/Action_Reference/init

Example from Codex:

add_action('init', 'process_post');

function process_post(){
 if(isset($_POST['unique_hidden_field'])) {
   // process $_POST data here
 }
}

Leave a Comment