<? if (empty($_username))
{?>
<form name="form1" method="post" action="">
<p>
<input name="_username" type="text" id="_username">
</p>
<p>
<input name="_password" type="text" id="_password">
<input type="submit" name="Submit" value="提交">
</p>
</form>
<? }
else
{
if ($_username=='abc' && $_password=='1')
echo "php成功登录,页面跳转中,请稍候……";
else echo "用户名或密码不对,请重新输入";
}
?>//输出为 “php成功登录,页面跳转中,请稍候……”
{?>
<form name="form1" method="post" action="">
<p>
<input name="_username" type="text" id="_username">
</p>
<p>
<input name="_password" type="text" id="_password">
<input type="submit" name="Submit" value="提交">
</p>
</form>
<? }
else
{
if ($_username=='abc' && $_password=='1')
echo "php成功登录,页面跳转中,请稍候……";
else echo "用户名或密码不对,请重新输入";
}
?>//输出为 “php成功登录,页面跳转中,请稍候……”
你先输出$_username, $_password看看
我用echo和print分别输出$_username,$_password,然后得到一个空白页面!代码如下:<?php
print "$_username";//print or echo
print "$_password";//print or echo
?>我的提交表单是这样的:<form action="login2.php" method="post">
<TABLE width="450" border="0" align="center">
<TR align="left">
<TD height="30" width="27%" align="left">请登陆后查看</TD>
<TD height="30" width="22%" align="center"> 用户名 </TD>
<TD height="30" width="*" align="center"><input type="text" name="_username"/></TD>
</TR>
<TR align="left">
<TD height="30" width="27%" align="left"></TD>
<TD height="30" width="22%" align="center"> 密码 </TD>
<TD height="30" width="*" align="center"><input type="text" name="_password"/></TD>
</TR>
<TR align="left">
<TD height="30" width="27%" align="left"></TD>
<TD height="30" width="22%" align="right"><input type="submit" value="登录"/></TD>
<TD height="30" width="*" align="left"></TD>
</TR>
</TABLE>
</form>然后的php处理页面就是上面的那个:<?php
if ($_username=='abc' && $_password=='1')
{echo "php成功登录,页面跳转中,请稍候……";}
else {echo "用户名或密码不对,请重新输入";}
?>我怎么也看不出了,大家帮看看啊!
$_POST['_password']
指教!if ($_POST['_username']=='abc' && $_POST['_password']=='1')
{echo "php成功登录,页面跳转中,请稍候……";}
else {echo "用户名或密码不对,请重新输入";}
?>而且输出我也改啦!也不行!<?php
print $_POST['_username'];
print $_POST['_password'];
?>请指教!!!
$_POST['_username']
$_POST['_password']
改成
$_POST[_username]
$_POST[_password] 谢谢大家了,那我把分加了!