我是wordpress的新手,我在wordpress前端用户中创建了一个表单。 enter image description here
我粘贴了我用于在数据库中提交数据的代码。
if(isset($_POST['btnsbmt'])){
global $wpdb;
$data_array = array(
'name' => $_POST['name'],
'email' => $_POST['email'],
'adrs' => $_POST['adrs'],
'phone' => $_POST['phone'],
'subject' => $_POST['subject'],
);
$table_name = 'pform';
$result = $wpdb->insert($table_name, $data_array, $formate=NULL);
if($result == 1){
echo "<h2>Form has been submitted</h2>";
}
else{
echo "<h2>Something went wrong</h2>";
}
}
如何从前端编辑或更新此内容?