• 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代码移到最后

  • 相关阅读:
    QT中的列表容器
    QT中的Buttons
    QT中的常用控件
    [机房测试]弟娃
    CF1580C Train Maintenance
    [机房测试]数据恢复
    Sentry 监控
    Sentry 监控
    Sentry 监控
    Sentry 后端监控
  • 原文地址:https://www.cnblogs.com/ryanzheng/p/8224025.html
Copyright © 2020-2023  润新知