English 中文(简体)
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 $_SESSION[ 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.





相关问题
why the session in iis automatically log out?

I used iis6, and when i called a function Directory.delete(), the all the session relate this website will be logged out. and i debugged the website, i found no exception. any one have ideas on this ? ...

Check session from a view in CodeIgniter

What is the best way to check session from a view in CodeIgniter, it shows no way in their user guide, otherwise I will have to make two views on everything, which is kinda weird...still a newbie to ...

Can I get the size of a Session object in bytes in c#?

Is it possible to get the size(in bytes) of a Session object after storing something such as a datatable inside it? I want to get the size of a particular Session object, such as Session["table1"], ...

提供严格分类的出席会议物体

提供严格分类的与会机会的最佳方式是什么? 我正计划转而选择矩阵,这正在促使汇编者抱怨我的幻觉方案拟订方法......

PHP Session is not destroying after user logout

I m trying to create an authentication mechanism for my PHP Application and I m having difficulty destroying the session. I ve tried unsetting the authentication token which was previously set within ...

热门标签