Notice: Undefined index: m in

时间:2017-06-09 12:46:30

标签: php

Notice: Undefined index: m in C:\xampp\htdocs\test.php on line 2

Notice: Undefined index: uname in C:\xampp\htdocs\test.php on line 3

<?
$m = $_REQUEST["m"];
$uname = $_REQUEST["uname"];
if($m=="chkfrm"){   //Check about true values
    if($uname==""){ //if input form 'uname' is null
?>
No content


<?
    } else { // Else input form 'uname' is value
    //$m="";    // Reset chkfrm
?>
In Content


<? }
} else { //Main page
?>


<form name="aa" method="post" action="./test.php">
<input type="hidden" name="m" value="chkfrm">
<input type="text" name="uname" size="30">
<p>
<input type="image" src="./jigoku/images/name.gif" class="mouse" onClick="javascript:returns();">
</p>
</form>
<?
}   //Main End
?>

1 个答案:

答案 0 :(得分:0)

Use isset() when assigning the variable.

$m = isset($_REQUEST['m']) ? $_REQUEST['m'] : null;