我正在使用$wpdb->insert将表单数据放置到自定义数据库中。不过,发生了很多事情。将数据发送到数据库的页面被捕获在iframe中。我知道如何将其从iframe中取出,但是,当我这样做时,除了初始重定向之外,还会导致重定向。如何确保数据只发送一次?我不希望数据库中有两个条目,因为它正在重定向两次。以下是重要的几点:
WPDB->插入零件
if(isset($qualification, $first_name, $middle_initial, $last_name, $email, $street_address, $city, $state, $zip, $phone)) {
global $wpdb;
$wpdb->insert(
\'wp_mstops_user_info\',
array(
"first_name" => $first_name,
"middle_initial" => $middle_initial,
"last_name" => $last_name,
"email" => $email,
"street_address" => $street_address,
"city" => $city,
"state" => $state,
"zipcode" => $zip,
"phone" => $phone,
"qualification_data" => $qualification,
"substudy_data" => $substudy_json
)
);
}
从iframe零件中弹出:
<script type="text/javascript">
if (top.location!= self.location) {
top.location = self.location.href;
}
</script>