Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/62.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
Mysql 使用wordpress 4.7将表单值插入数据库表_Mysql_Wordpress - Fatal编程技术网

Mysql 使用wordpress 4.7将表单值插入数据库表

Mysql 使用wordpress 4.7将表单值插入数据库表,mysql,wordpress,Mysql,Wordpress,我是WordPress的新手。我正在尝试将表单数据插入数据库表(pack)。 如何将数据值插入数据库表..我不使用任何插件。只需创建一个注册表(姓名、年龄、地址)。如何使用mysql查询将这些值插入表中 提交后查看页面未找到 在samepage中使用设计和过程代码尝试一下这可能会帮助您实现更好的设计 if ( isset( $_POST['submit'] ) ){ global $wpdb; $tablename=$wpdb->prefix.'pack';

我是WordPress的新手。我正在尝试将表单数据插入数据库表(pack)。 如何将数据值插入数据库表..我不使用任何插件。只需创建一个注册表(姓名、年龄、地址)。如何使用mysql查询将这些值插入表中

提交后查看页面未找到


在samepage中使用设计和过程代码

尝试一下这可能会帮助您实现更好的设计
if ( isset( $_POST['submit'] ) ){    
    global $wpdb;
    $tablename=$wpdb->prefix.'pack';    
    $data=array(
        'name' => $_POST['name'], 
        'age' => $_POST['age'],
        'adrress' => $_POST['adrress'], 
         );
     $wpdb->insert( $tablename, $data,array( '%s', '%s', '%s' ));
}    
?>

使用。iam使用此代码将值插入到表名称:Offer:Prize:
设计页面和处理代码的同一页Sir我有个问题..如何连接到数据库?。如果有任何请求,则一次(“”);使用??我没有使用任何东西。是的,你必须加载wordpress的配置文件,比如require_once('/wp config.php');但是siri gotpage not found error and not save to database table.my form and process在主题文件夹中创建wed.php文件,然后我去dashbord添加新页面(wed)并选择我的模板(wed),然后发布和查看页面(),我可以看到我的表单,我会填写字段并提交,在同一url中找不到显示页面。您必须在主题文件夹中创建模板,您的自定义表单将设计初始化,并从wp admin create page中选择您为表单创建的模板。