我将我认为是对 php 表单处理脚本的简单补充(在将数据发送到电子邮件后将数据插入数据库)放在一起。
出于某种原因,我总是收到错误消息,并且数据的实际输入永远不会进入数据库。我已将查询添加到输出中,并且所有接收到的值似乎都正常。
提前致谢。
// username, passw, database are all defined earlier in code.
// all the variables are taken out of form inputs (and they all arrive fine by email.
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
//inserting data order
$order = "INSERT INTO flights('restime', 'flyfrom', 'flyto', 'dateoutbound', 'outboundflex', 'datereturn', 'returnflex', 'pax', 'klasse', 'name', 'email', 'phone', 'comments', 'status') VALUES('$date', '$fly_from', '$fly_to', '$date_outbound', '$outbound_flex', '$date_return', '$return_flex', '$pax', '$class', '$name', '$email', '$phone', '$comments', '1')";
//declare in the order variable
$result = mysql_query($order); //order executes
if($result){
echo("<br>Input data is succeed");
} else{
echo("<br>Input data is fail");
echo $order;
}
提前非常感谢。