Php 在页面上显示url变量消息
我有一个带有authController的表单页用于验证。 以下是表单页面的代码:Php 在页面上显示url变量消息,php,forms,url,controller,get,Php,Forms,Url,Controller,Get,我有一个带有authController的表单页用于验证。 以下是表单页面的代码: <div class="main-content"> <h3>log in as student</h3> <h3> <!-- SHOW URL MESSAGE HERE --> </h3> <form action="../app/controllers/authController.p
<div class="main-content">
<h3>log in as student</h3>
<h3>
<!-- SHOW URL MESSAGE HERE -->
</h3>
<form action="../app/controllers/authController.php" class="login_form" method="POST">
<div class="form-group">
<label for="username">Username</label>
<input type="text" name="username" id="" class="input_field">
</div>
<div class="form-group">
<label for="password">Password</label>
<input type="password" name="password" id="" class="input_field">
</div>
<div class="form-group">
<input type="submit" name="type" id="" value="Log In" class="btn btn-info">
</div>
</form>
</div>
如何在表单页面上显示authController中定义的$err\u msg,其中
$user->redirect('stu_login.php?type=' . $err_msg);
到
在stu_login.php中使用
<h3>
<!-- ERROR OR OTHER MESSAGE -->
<?php
if(isset($_GET['msg'] != '')
echo $_GET['msg'];
?>
</h3>
哪个框架?为什么不试试AJAX呢?或者干脆ifisset$\u GET['type']!=?!!我不喜欢使用与提交按钮名称相同的变量名称。这是一个信息,所以,相关的名称会更好。我的意思是,这不是一个prober的方式做,无论是消息或类型或任何其他,特别是OP没有提供公平的细节,他的环境;是的,你是对的,这是我们能提供的最低解决方案suggest@MayaShah我试过了,当我加载表单页面时,我收到了以下错误消息:致命错误:无法对表达式的结果使用isset您可以使用null!==第6行的C:\wamp64\www\Websites\CapitoWonen\public\u html\stu\u login.php中的表达式
$user->redirect('stu_login.php?msg=' . $err_msg);
<h3>
<!-- ERROR OR OTHER MESSAGE -->
<?php
if(isset($_GET['msg'] != '')
echo $_GET['msg'];
?>
</h3>