I started writing my own WordPress plugin. I want to catch data presented from an HTML form on a custom template page that I created. I donโt have the right idea about how data is handled in WordPress.
This is the code I'm using in the new_page.php file.
get_header(); ?> <div id="primary" class="site-content"> <div id="content" role="main"> <?php while ( have_posts() ) : the_post(); ?> <?php <?php <form name="nn" action="" method="post"></br></br> <input type="text" name="test" width="20" /> <input type="submit" value="Submit" /> </form> <?php testpost();?> <?php endwhile; </div> </div> <?php get_sidebar(); ?>
Here is the code that I use in the plugin file to catch the data of the post variable.
ini.php (plugin main page)
function testpost(){ echo $_post['test']; }
This code does not do what I need. Can someone help me get values โโfrom HTML inputs?
source share