开发者

why is the value of textbox (this value is retrieved from the sessions using php) in html shown in IE

Okay the code is,

code in 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 $_S开发者_JS百科ESSION['info']['firstname']; }?>" name="firstname">
</form>

i have saved the file in php and the "script.php" page has all the code related to intialising the sessions in php like so

code in script.php

<? $info=new array();
$info['firstname]=$_POST['firstname'];
$info['lastname]=$_POST['lastname'];
session_start();
$_session['info']=$info;
?>

now when i open "first.php" in IE, the textbox is being filled with

<?PHP if(isset($_SESSION['info']['firstname'])){echo $_SESSION['info']['firstname']; }?>" 

why is it so.thanks in advance.


Its look like you have a syntax error in script.php, it should be like this:

<?php
$info=new array();
$info['firstname']=$_POST['firstname'];
$info['lastname']=$_POST['lastname'];
session_start();
$_session['info'] = $info;
?>


Are you sure you access the page via a webserver?

In other words do you access it by http://youserver/first.php and not simply open the first.php file in IE file file:///path/first.php


You're likely seeing that because you've got <?PHP instead of <?php.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜