0
私は必要に応じて動作しているが、私はフロントエンドで問題に直面している、私はショートコードページを作成してから、私が次のものをリフレッシュすると、何度もデータベースに値が送られています。私がする技術者・スタート・レポート・ページに到達するとWordpressのプラグインフォームは、すべてのブラウザの更新時にデータベースに提出する
function technician_checklist_report_generated(){
global $current_user;
global $wpdb;
$submit="";
if($_POST['customerid']!=""){
$crow = $wpdb->get_row('SELECT customer_id, firstname, lastname, createdon, marina, vesselmodel, vesselname, vesselyear
FROM wp_yacht_customers
WHERE customer_id= '.$_POST['customerid']
);
}
if($crow->customer_id!=""){
$table = 'wp_yatch_vessel_config_checklist';
array_pop($_POST); // delete last element in post array (submit)
$data = $_POST;
$format;
$wpdb->insert($table, $data, $format);
}
require(dirname(__FILE__) .'/view/technician-start-reporting.php');
}
add_shortcode('technician-start-reporting',
'technician_checklist_report_generated');
それはブラウザの更新に何度も何度もMySQLへデータを送信している:私はそれを停止したい、ここでの関数です。
私はwp_redirectを使用し、それがすでに送信エラー」ヘッダを示すため、別のページに移動する他の方法があります...:コンテンツがブラウザに送信される前に
ようこそ。この[how-to-ask](http://stackoverflow.com/help/how-to-ask)を読んで、コードの書式を修正してください。 – thewaywewere