为什么IE中显示了html中textbox的值(该值是使用php从会话中检索的)
好的,代码是 first.php中的代码为什么IE中显示了html中textbox的值(该值是使用php从会话中检索的),php,html,textbox,session,Php,Html,Textbox,Session,好的,代码是 first.php中的代码 <?PHP session_start(); include("script.php"); ?> <form action="script.php" method=POST> <input type="text" value="<?PHP if(isset($_SESSION['info']['firstname'])){echo $_SESSION['info']['firstname']; }?>" nam
<?PHP
session_start();
include("script.php");
?>
<form action="script.php" method=POST>
<input type="text" value="<?PHP if(isset($_SESSION['info']['firstname'])){echo $_SESSION['info']['firstname']; }?>" name="firstname">
</form>
现在,当我在IE中打开“first.php”时,文本框中充满了
<?PHP if(isset($_SESSION['info']['firstname'])){echo $_SESSION['info']['firstname']; }?>"
”
为什么会这样。提前谢谢。您确定要通过Web服务器访问该页面吗
换句话说,您是通过访问它,而不是简单地打开IE文件中的第一个.php文件吗file:///path/first.php看起来script.php中有语法错误,应该是这样的:
<?PHP
session_start();
include("script.php");
?>
<form action="script.php" method=POST>
<input type="text" value="<?PHP if(isset($_SESSION['info']['firstname'])){echo $_SESSION['info']['firstname']; }?>" name="firstname">
</form>
<?php
$info=new array();
$info['firstname']=$_POST['firstname'];
$info['lastname']=$_POST['lastname'];
session_start();
$_session['info'] = $info;
?>
您可能会看到这一点,因为您有并且会话调用是$\u会话,而不是$\u会话