0
我是wordpress插件開發新手。我做了一些編碼和足夠了解如何製作菜單 - 子菜單等。在一個子菜單頁面中,我製作了一個表單,用於在數據庫中的一個mytable中更改電子郵件ID。但要停止頁面上的數據插入重新加載/刷新/頁面返回我必須提供一個標題功能,但我無法做到這一點。WP頭重新加載
更簡單的話我只是想停止wordpress插件插入/更新頁面刷新表中的數據。請閱讀我的編碼。
<form method="post" enctype="multipart/form-data">
<label><b>Mention Your Email Here :</b></label>
<input type="email" name="email" id="email" placeholder="Enter your email here"/><br/><br/>
<input type="submit" name="set" id="set" value="CHANGE"/>
</form>
<br/><br/>
<u>NOTE</u> :<br/>
1. Please write your email id in the field given above. This email id will be used to get emails of visitors contact query.
<br/>
2. Copy the shortcode given below to show the form on the website.<br/>
<b>[myplugin]</b>
<?php
//getting the form email id value
if (isset($_POST['set']) && !empty($_POST['email'])) {
$email = $_POST['email'];
global $wpdb;
$table_name = $wpdb->prefix . "myemail";
$result = $wpdb->update($table_name, array('id' => '1', 'email' => $email), array('id' => '1'));
if ($result > 0) {
echo "<script>alert('Successfully Updated');</script>";
} else {
exit(var_dump($wpdb->last_query));
}
$wpdb->flush();
} else {
header('location: ------?????--------------');
}
?>
在頁眉中,我應該寫什麼,以便頁面在重新加載後進入同一頁面。但沒有插入/更新數據。