首页上一页 1 下一页尾页 3 条记录 1/1页
《PHP程序开发范例宝典》开始的表单例子,按钮提交能通过吗
发表在PHP图书答疑
2009-02-23
是否精华
是
否
版块置顶:
是
否
<?php
if($Submit=="提交"){
$username=$_POST[username];
$password=$_POST[password];
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>获取文本框提交的值</title>
<style type="text/css">
<!--
.style1 {font-size: 13px}
-->
</style>
</head>
<body>
<table width="283" height="85" border="1" cellpadding="0" cellspacing="0" background="images/admin2.gif">
<form name="form1" method="post" action="index.php">
<tr>
<td width="114" height="30" align="center" class="style1">管理员:</td>
<td width="163" height="30" align="center"><input name="username" type="text" id="username4" size="20"></td>
</tr>
<tr>
<td align="center" class="style1">密码:</td>
<td height="30" align="center"><input name="password" type="password" id="password" value="" size="20"></td>
</tr>
<tr>
<td> </td>
<td height="25"> <input type="submit" name="Submit" value="提交"></td>
</tr>
</form>
</table>
</span>
<table width="284" border="1" cellpadding="0" cellspacing="0">
<tr>
<td height="25" align="center" class="style1"><?php echo "管理员:$username"?></td>
</tr>
<tr>
<td height="25" align="center" valign="middle" class="style1"><?php echo "密码:$password";?></td>
</tr>
</table>
</body>
</html>
以上是光盘源码,能输出结果吗??? if语句做判断那 $Submit不用传值就能获取吗?
难道是我的php环境有问题???
if($Submit=="提交"){
$username=$_POST[username];
$password=$_POST[password];
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>获取文本框提交的值</title>
<style type="text/css">
<!--
.style1 {font-size: 13px}
-->
</style>
</head>
<body>
<table width="283" height="85" border="1" cellpadding="0" cellspacing="0" background="images/admin2.gif">
<form name="form1" method="post" action="index.php">
<tr>
<td width="114" height="30" align="center" class="style1">管理员:</td>
<td width="163" height="30" align="center"><input name="username" type="text" id="username4" size="20"></td>
</tr>
<tr>
<td align="center" class="style1">密码:</td>
<td height="30" align="center"><input name="password" type="password" id="password" value="" size="20"></td>
</tr>
<tr>
<td> </td>
<td height="25"> <input type="submit" name="Submit" value="提交"></td>
</tr>
</form>
</table>
</span>
<table width="284" border="1" cellpadding="0" cellspacing="0">
<tr>
<td height="25" align="center" class="style1"><?php echo "管理员:$username"?></td>
</tr>
<tr>
<td height="25" align="center" valign="middle" class="style1"><?php echo "密码:$password";?></td>
</tr>
</table>
</body>
</html>
以上是光盘源码,能输出结果吗??? if语句做判断那 $Submit不用传值就能获取吗?
难道是我的php环境有问题???