zoukankan      html  css  js  c++  java
  • PHP cannoy modify header information

    我采用的是MVC模式的写法,代码和html分离的写法

    <?php 
    require '../mysql_connect.php';
    require('../model/functions.php');
    include_once '../views/login.html.php';
     if ($_SERVER['REQUEST_METHOD'] == 'POST') {   // 处理表单
     	if (isset($_POST['login_submit'])) {
    
            $role = $_POST['role'];
     		$username = $_POST['username'];
            $passwd = $_POST['p'];
    
        if( user_login($pdo,$role,$username,$passwd) ){
            setcookie('userName',$name);              
            setcookie('password',$psw);    
            header("location: index.php");  
        }else{
            echo "<script>alert('输入信息错误,登录失败');</script>";
        }
    
    
     	}elseif (isset($_POST['get_password'])) {
    
            $email = $_POST['email'];
            user_register($pdo,$email);
     	}
    }
    

      

    我在一个页面内写了两个form表单,但是两个表单都是提交到同一个PHP文件处理,到时提交第二个表单时就一直报这种错误,

     

     解决方法:

    只需要将第四行的html代码移到最后

  • 相关阅读:
    1066 Bash 游戏
    1070 Bash 游戏 V4
    codevs 2928 你缺什么
    分块、线段树练习
    Father Christmas flymouse
    codevs 2494 Vani和Cl2捉迷藏
    codevs 2144 砝码称重2
    国王游戏
    codevs 1664 清凉冷水
    2015ACM/ICPC亚洲区沈阳站 Pagodas
  • 原文地址:https://www.cnblogs.com/ryanzheng/p/8224025.html
Copyright © 2011-2022 走看看