php 解决Notice: Undefined index:

来源:互联网 发布:mysql自动备份数据库 编辑:程序博客网 时间:2024/05/16 01:21
<html>    <body>        <form name="form1" method="post" action="">            <table width="352" border="0" cellpadding="0" cellspacing="0">                <tr>                    <td width="352" height="30"> 用户名:                    <input name="user" type="text" size="12">                    密码:                    <input name="pwd" type="password" id="pwd" size="12">                    <input name="submit" type="submit" id="submit" value="登录"></td>                </tr>            </table>        </form>        <?php        //~ function _post($str){            //~ $val = !empty($_POST[$str]) ? $_POST[$str] : null;            //~ return $val;        //~ }        if(!empty($_POST["submit"]) && $_POST["submit"]=="登录")        {            $user = $_POST["user"];            $pwd = $_POST["pwd"];            echo "<br \>user=$user password=$pwd";        }        ?>    </body></html>

原创粉丝点击