Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 在Wordpress中使用表单和Get/Post_Php_Wordpress - Fatal编程技术网

Php 在Wordpress中使用表单和Get/Post

Php 在Wordpress中使用表单和Get/Post,php,wordpress,Php,Wordpress,我有一个名为wc-info.php的页面,它是使用这个函数在一个名为plugin_admin.php的页面上加载的 部分内容如下所示: <div class="welcome-panel-column"> <form action="POST"> <input type="text" action="" name="gtin_search"> <input type="submit" action="" name=

我有一个名为wc-info.php的页面,它是使用这个函数在一个名为plugin_admin.php的页面上加载的

部分内容如下所示:

<div class="welcome-panel-column">
    <form action="POST">
        <input type="text" action="" name="gtin_search">
        <input type="submit" action="" name="gtin_submit">
    </form>
</div

试试这个

function custom_function() {
    if ( isset( $_POST['gtin_search'] ) ) {
        // Update to the function which you are going to use
        get_gtin_woo_db($POST['gtin_search']);   
    } // end if
}
add_action( 'init', 'custom_function' );

我希望这会有所帮助。

您是否尝试过添加操作('init','some_function');并检查post变量。然后将数据发送到你的函数?谢谢,但是这个函数会去哪里?在plugin或functions.php的root functions.php中,我更喜欢functions.php。
function custom_function() {
    if ( isset( $_POST['gtin_search'] ) ) {
        // Update to the function which you are going to use
        get_gtin_woo_db($POST['gtin_search']);   
    } // end if
}
add_action( 'init', 'custom_function' );