php

WBOY
Release: 2016-06-13 13:36:41
Original
1434 people have browsed it

php求助
include "mysql.inc.php";
session_start();
echo "

";
echo "";
echo "";
echo "
航班信息:";
echo $_SESSION["_flight"]."   ";
echo $_SESSION["_from"]."-";
echo $_SESSION["_to"]."   ";
echo $_SESSION["_date"]."   ";
echo $_SESSION["_takeoff"]."-";
echo $_SESSION["_arrive"]."   ";
echo $_SESSION["_company"]."   ";
echo $_SESSION["_cabin"]."   ";
echo $_SESSION["_price"]."   ";
echo "
";
echo "乘客姓名:".$_POST[name]."
";
echo "身份证号:".$_POST[idnum]."
";
echo "联系人姓名:".$_POST[contact]."
";
echo "联系电话:".$_POST[phone]."
";

?>

      



if($submit2){
$sql="insert into psgrinfo values ('','$_POST[name]','$_POST[idnum]')";
mysql_query($sql);
// header("Location:ordering.php");
}

?>

问题是写入数据库时,能够写入,第一字段为自动添加,但是后面两个字段都是空的,之前乘客姓名那$_POST[name]输出是没有问题的,求解决办法

------解决方案--------------------
引用




if($submit2){

------解决方案--------------------
楼主这个问题是程序逻辑错误,建议把获取的值暂存到变量里
------解决方案--------------------
表单提交一次数据插入数据库一次。这还能怎么办?当插入之后做跳转,需要在填写表单一次重新填写(做新的数据了)或者跳转到别的页面,看你的业务啊。
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template