Saturday, May 21, 2016

WordPress get form post data

WordPress supports forms and there are many extension for forms available on the WordPress plugin repository. When form is submitted it is processed and submitted as defined in the plugin.

But sometimes we need the form data and for that we cannot customize the plugin as hacking the core of plugin is bad idea and an plugin update in the future will erase all our changes done.

So, to get the posted form data you can use the following code.

<?php
    foreach($_POST as $key=>$post_data){
        echo "You posted:" . $key . " = " . $post_data . "<br>";
    }
?>

using this you can get the form key and its value.

No comments:

Post a Comment

MS SQL : How to identify fragmentation in your indexes?

Almost all of us know what fragmentation in SQL indexes are and how it can affect the performance. For those who are new Index fragmentation...