我使用php和javascript构建了一个在chrome中运行良好的Web表单。但是从IE或Firefox查看时。所有数据都在最终页面上正确显示,但实际上没有任何内容提交到我的数据库(MySQL / phpmyadmin)。这些提交在chrome上正常工作。当使用最新版本的phpmyadmin和mysql对更高版本的apache进行测试时没有问题。我如何解决apach2.2和mysql 5.5.42以解决这个问题...
<?php
$premC;
$NoR;
$CC;
$SD;
$HD;
$pack1;
$pack2;
$pack3;
$equipC;
$roomC;
$totalC;
$fname;
$lname;
$emailV;
$_SESSION['rebate'] = $_POST['rebate'];
$connect = mysqli_connect('localhost','*****','*****','*****');
if(!$connect){
die('Could not Connect: ' . mysqli_error($connect));
}
$stmt = $connect->prepare("INSERT INTO form_test (Number_of_Rooms,Current_Monthly_Cost,SD,HD,Family,Entertainment,Ultimate,Premium_Features,Equip_Cost,Room_Cost,Total,First_Name,Last_Name,Email) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
$stmt->bind_param("ssssssssssssss",$NoR,$CC,$SD,$HD,$pack1,$pack2,$pack3,$premC,$equipC,$roomC,$totalC,$fname,$lname,$emailV);
if(isset($_POST['number_rooms'])){ $NoR = $_POST['number_rooms'];$_SESSION['nRooms'] = $NoR; $stmt->execute();}
if(isset($_POST['current_cost'])){ $CC = $_POST['current_cost']; $stmt->execute();}
if(isset($_POST['sd'])){ $SD = $_POST['sd']; $stmt->execute();}
if(isset($_POST['hd'])){ $HD = $_POST['hd']; $stmt->execute();}
if(isset($_POST['family'])){ $pack1 = $_POST['family']; $stmt->execute();}
if(isset($_POST['entertainment'])){ $pack2 = $_POST['entertainment']; $stmt->execute();}
if(isset($_POST['ultimate'])){ $pack3 = $_POST['ultimate']; $stmt->execute();}
if(isset($_POST['premium'])){ $premC = $_POST['premium']; $stmt->execute();}
if(isset($_POST['equipCost'])){ $equipC = $_POST['equipCost'];$_SESSION['pEquip'] = $equipC; $stmt->execute();}
if(isset($_POST['roomCost'])){ $roomC = $_POST['roomCost'];$_SESSION['pRoom'] = $roomC;$stmt->execute();}
if(isset($_POST['total'])){ $totalC = $_POST['total'];$_SESSION['pTotal'] = $totalC;$stmt->execute();}
if(isset($_SESSION['fname'])){$fname = $_SESSION['fname']; $stmt->execute();}
if(isset($_SESSION['lname'])){$lname = $_SESSION['lname']; $stmt->execute();}
if(isset($_SESSION['email'])){$emailV = $_SESSION['email']; $stmt->execute();}
mysqli_close($connect);
如果您需要更多信息,请告诉我们。任何帮助将不胜感激。
更新
<script type="text/javascript">
window.onload = function pageRedirect(){
window.location="fForm.php";
}
</script>
答案 0 :(得分:0)
在一个周末撞墙后,我发现了问题。这个问题非常简单。
$POST()
vs
$_POST()
一个非常小的错字导致了我的
if(isset($_SESSION['email'])){$emailV = $_SESSION['email']; $stmt->execute();}
返回false而不是执行语句。我这是一个非常小的愚蠢错误。我想接下来的问题是为什么Chrome会纠正这个而不是IE?