自动重新加载页面错误是php中未定义的索引

时间:2014-03-18 09:32:10

标签: php

我是php的初学者..请帮忙,, 我使用GET将数据从一个页面传递到另一个页面 我正在使用以下代码自动重新加载页面。

<?php require_once ("includes/sessions.php"); ?>
<?php
$page = $_SERVER['PHP_SELF'];
$sec = "100000";
?>

 <?php include ("includes/connection.php"); ?>
 <?php 
   conferm_login();
?>

<html>
<head>
<meta http-equiv="refresh" content="<?php echo $sec?>;URL='<?php echo $page?>'">
</head>
<body>

<?php 

$usr = $_GET['usr']; 
$usr2='';
if($usr=='User1')
    $usr2='User2';

它工作正常但在自动刷新后我得到的错误是未识别的index.pointing变量,即$ user = $ _ GET [&#39; usr&#39;]即使在我发送数据的前几页中也是如此。我还用if(isset($ _ GET [&#39; usr&#39;])包装$ user = $ _ GET [&#39; usr&#39;]但是没有输出。

1 个答案:

答案 0 :(得分:0)

<?php 
require_once ("includes/sessions.php");
include ("includes/connection.php");

$page = basename($_SERVER['REQUEST_URI']);
$sec = "100000";
   conferm_login();

<html>
<head>
<meta http-equiv="refresh" content="<?php echo $sec?>;URL='<?php echo $page?>'">
</head>
<body>

<?php 

$usr = $_GET['usr']; 
$usr2='';
if($usr=='User1')
    $usr2='User2';
?>