I have custom post type called "forms", and has a sub-menu page which contains form, to add a name.
add_action('admin_menu', 'form_builder_add');
function form_builder_add() {
//create new top-level menu
add_submenu_page('edit.php?post_type=forms', 'Add name', 'Add name', 'manage_options', 'form-dashboards', 'add_names');
}
function add_names() {
echo
'
<form method="post" action="">
<input type="text" name="name" id="name" />
<input type="submit" value="submit" />
</form>
';
}
and I have shortcode and foocode where I want to spit out the values from the form.
add_shortcode( 'foocode', 'prefix_foocode' );
function prefix_foocode() {
return 'This is '. $_POST['name'] . ' testing';
}
So when I call the shortcode from the post, it should have the value of name from the form.
[foocode]
This is example name testing.