改写为:
<body>
<?
print "the username is:";
echo $Username;
print "<br>";
print "the password is:";
echo $Password;
print "<br>";
?>
</body>另外请注意提交前后的变量名有否写错:
name="Passwoed" ???
<body>
<?
print "the username is:";
echo $Username;
print "<br>";
print "the password is:";
echo $Password;
print "<br>";
?>
</body>另外请注意提交前后的变量名有否写错:
name="Passwoed" ???
可按仁兄的方法仍然无发显示
小弟刚从PB转到PHP有几个问题不明白:
1.对于表单提交,如何接收其数据?
2.submit点击事件如何执行?
3.向上个例子,发送到本页,也能接收?
如何传送到其它页?
改為
<form action = "TEST.php" method = "post" name=form1>
action後面就是接受post的數據的程序。
如果本頁接受本頁的數據不用加上action,另外注意變量名大小些敏感,如果是linux服務器,文件名大小些也敏感
<?
print ("the username is:$Username<br>");
print ("the password is:$Password<br>");
?>这是表但程序:testform.php
<html>
<head>
<title>TEST</title>
</head>
<body>
<form action = "test.php" method = "post">
UserName : <input type ="text" name="Username"><br>
Password: <input type ="password" name="Password"><br>
<input type ="Submit" name="Submit"value="提交"><br>
</form>
</body>
</html>
运行testform.php 表但提供的数据交给test.php处理你就可以看到提交的数据了。注意:<form></form>
不是<from></from>
要区分大小写,尤其是在unix or linux 服务器上=============================
偶的php论坛:www.chinesehis.com/starry/index.php
按你的方法能够实现,但对同一个web页呢?
if ($Submit=="提交")
{
echo "The username is : $Username<br>";
echo "The password is : $Password<br>";
exit;
}
?>
<form method = "post">
UserName : <input type ="text" name="Username"><br>
Password : <input type ="password" name="Password"><br>
<input type ="Submit" name="Submit"value="提交"><br>
</form>把这段代码贴到一个PHP文件中 运行 :)