Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/250.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 提交表单后,不显示目标页面_Php - Fatal编程技术网

Php 提交表单后,不显示目标页面

Php 提交表单后,不显示目标页面,php,Php,我有一个employee表,但在提交时,表单数据会在SQL数据库的employee表中更新,但不会显示employee数据页(标题(

我有一个employee表,但在提交时,表单数据会在SQL数据库的employee表中更新,但不会显示employee数据页(
标题(
)。当我删除字段时,它可以完美地在员工数据页面上显示数据。下面是我的PHP代码。有人,请帮帮我

<html>
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width,initial-state=1"/>
<link type="text/css" rel="stylesheet" href="css/bootstrap.css"/>
<script src ="js/jquery-3.4.1.min.js" ></script>
<script src ="js/bootstrap.js" ></script>
<link rel="stylesheet" href="stylemenu.css">
<style type="text/css">
body
{
    background-image:url(water.png);
    background-size:cover;
}
</style>
</head>
<body>
<?php
session_start();
include("samadonconnection.php");
error_reporting(0);
?>
<div class ="container">    
<div class="row">
<div class="col-sm-6"> <h2> Test </h2> </div>
<div class="col-sm-6"> 
<?php echo "<div style=\"float:right\"> Welcome ". $_SESSION['user']['username']."! </div>"; ?> </div>
</div>
 <div class="topnav">
<div class="col-sm-12">
<a href="home.php">HOME</a>
<a href="create_user.php"> + ADD USER</a>
<a class="active" href="employee.php" style="color:blue;">EMPLOYEE</a>
<a href="employeedata.php">EMPLOYEE DATA</a>
<a href="home.php?logout='1'" style="color: red;">LOG OUT</a>
<a href="cont.php">CONTACT US</a>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<div id="ui"> 
<form action="" method="GET" class="form-group">
<div class="row">
<div class ="col-lg-3">
<label> Today Date :</label>
<input type ="date" name ="date" class ="form-control"  placeholder=".....">
</div>
<div class ="col-lg-3">
<label> Birth Date :</label>
<input type ="date" name ="birth" class ="form-control"  placeholder="......">
</div>
<div class ="col-lg-3">
<label> Mobile :</label>
<input type ="text" name ="mobile" class ="form-control"  placeholder="......">
</div>
<div class ="col-lg-3">
<label> Father Name :</label>
<input type ="text" name ="father" class ="form-control"  placeholder=".....">
</div>
</div>
<br>
<div class="row">
<div class ="col-lg-3">
<label> First Name :</label>
<input type ="text" name ="fname" class ="form-control"  placeholder=".....">
</div>
<div class ="col-lg-3">
<label> Last Name :</label>
<input type ="text" name ="lname" class ="form-control"  placeholder="......">
</div>
<div class ="col-lg-3">
<label> Gender :</label>
<select name="gender" class="form-control"> 
<option> Choose ... </option>
<option> Male </option>
<option> Female </option>
</select>
</div>
<div class ="col-lg-3">
<label> Marital :</label>
<select name="marital" class="form-control"> 
<option> Choose ... </option>
<option> Married </option>
<option> Unmarried </option>
</select>
</div>
</div>
<br>
<div class="row">
<div class ="col-lg-3">
<label> Email :</label>
<input type ="text" name ="email" class ="form-control"  placeholder="......">
</div>
<div class ="col-lg-3">
<label> Qualification :</label>
<input type ="text" name ="qualification" class ="form-control"  placeholder=".....">
</div>
<div class ="col-lg-6">
<label> Address :</label>
<input type ="text" name ="address" class ="form-control"  placeholder="......">
</div>
</div>
<br>
<div class="row">
<div class ="col-lg-3">
<label> Pin Code :</label>
<input type ="text" name ="pin" class ="form-control"  placeholder="......">
</div>
<div class ="col-lg-3">
<label> District :</label>
<input type ="text" name ="district" class ="form-control"  placeholder=".....">
</div>
<div class ="col-lg-3">
<label> State :</label>
<input type ="text" name ="state" class ="form-control"  placeholder="......">
</div>
<div class ="col-lg-3">
<label> Country :</label>
<input type ="text" name ="country" class ="form-control"  placeholder="......">
</div>
</div>
<br>
<div class="row">
</div>
<br>
<input type ="submit" name ="submit" value ="SUBMIT" class ="btn btn-primary btn-block btn-lg">
</form>
<?php
if($_GET['submit'])
{
$da = $_GET['date'];
$bi = $_GET['birth'];
$mo = $_GET['mobile'];
$fa = $_GET['father'];
$fn = $_GET['fname'];
$ln = $_GET['lname'];
$ge = $_GET['gender'];
$ma = $_GET['marital'];
$em = $_GET['email'];
$qu = $_GET['qualification'];
$ad = $_GET['address'];
$pi = $_GET['pin'];
$di = $_GET['district'];
$st = $_GET['state'];
$co = $_GET['country'];
if( $fn!="" && $ln!="") 
{
$query = "INSERT INTO employee VALUES 
( '$sl','$da','$bi','$mo','$fa','$fn','$ln','$ge','$ma','$em','$qu','$ad' ,'$pi','$di','$st','$co')";
$data = mysqli_query($conn,$query);
if($data)
{
header('location:employeedata.php');
}
}
else
{
echo "All fields are required";
}
}
?>
</div>
</div>
</div>
</div>  
</body>
</html>

身体
{
背景图片:url(water.png);
背景尺寸:封面;
}
试验
今日日期:
出生日期:
流动电话:
父亲姓名:

名字: 姓氏: 性别: 选择。。。 男性 女性 婚姻的: 选择。。。 已婚的 未婚的
电邮: 资格: 地址:
Pin码: 地区: 声明: 国家:



将输出发送到浏览器后,无法执行标题重定向,将出现“标题已发送”错误。将表单处理代码移动到html输出之前。

将输出发送到浏览器后,无法执行标题重定向,将出现“标题已发送”错误。将表单处理代码移动到html输出之前。

CanyouPleaseIndentyYourCodeSoitBecomesReadableChange方法
GET
to
POST
并将
if($\u GET['submit'])if(isset($\u POST['submit'])){
。@CD001我不认为这是问题所在。我宁愿认为,正如西蒙所说,有太多的数据来适应一个问题GET@CidOP说数据被插入了,但重定向没有发生。我同意当数据被更新/插入时POST更合适,但如果这些部分工作正常,则表明数据在li范围内我不确定关于“删除某个字段”的评论是什么意思是说。@droopsnoot不是很好的捕获,我错过了那部分。因为OP说当一个人删除一些HTML时重定向会起作用,这肯定是一个足够大的缓冲区,可以输出到客户端CanyouPleaseIndentyYourCodeSoitBecomReadableChange方法
GET
POST
和change
if($\u GET['submit'])
if(isset($_POST['submit'])){
。@CD001我不认为这是问题所在。我宁愿认为,正如西蒙所说,有太多的数据来适应一个问题GET@CidOP说数据被插入了,但重定向没有发生。我同意当数据被更新/插入时POST更合适,但如果这些部分工作正常,则表明数据在li范围内mits。我不确定关于“删除某个时间字段”的评论是什么意思。@droopsnoot很好,我错过了那部分。因为OP说当删除一些HTML时重定向是有效的,这肯定是足够大的缓冲区,可以输出到客户端。如果这是答案,问题是重复的;)这个答案不一定是真的。输出可以“缓冲化”在发送之前,重定向可能会工作,即使之前有一些输出是的,这一点很好。我在OPs代码中查找缓冲函数,但没有看到它们,但忘记了它可以独立于代码进行设置。@droopsnoot如果我记得正确,它可以在php.ini中设置。我在想向朋友解释时已经遇到了这个问题在执行
标题(位置:…)
之前不应发送输出,重定向工作正常:)如果这是答案,则问题重复;)此答案不必为true。可以“缓冲”输出在发送之前,重定向可能会工作,即使之前有一些输出是的,这一点很好。我在OPs代码中查找缓冲函数,但没有看到它们,但忘记了它可以独立于代码进行设置。@droopsnoot如果我记得正确,它可以在php.ini中设置。我在想向朋友解释时已经遇到了这个问题在执行
标题(位置:…)
之前不应发送输出,并且重定向工作正常:)