<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>驗證兩次輸入的密碼是否相等</title>
</head>
<body>
<table width="409" border="2" cellpadding="20" cellspacing="2" bordercolor="#9900FF"bgcolor="#3366FF">
<form name="form1" method="post" action="">
<tr align="center">
<td height="24" colspan="20" class="style1"> 驗證兩次輸入的密碼是否相等 </td>
</tr>
<tr>
<td width="108" height="20" align="center" class="style1">用戶名:</td>
<td width="295" class="style3"><input name="username" type="text" id="username" size="20" maxlength="50"></td>
</tr>
<tr>
<td height="20" align="center" class="style1">密碼:</td>
<td class="style3"><input name="password" type="password" id="password" size="20" maxlength="50">
<span class="STYLE4">* 密碼不能爲空</span></td>
</tr>
<tr>
<td height="18" align="center" class="style1">密碼確認:</td>
<td class="style3"><input name="password1" type="password" id="password1" size="20" maxlength="50">
<span class="STYLE4">* 確認密碼不能爲空</span> </td>
</tr>
<tr>
<td height="37" align="center"> </td>
<td ><input type="submit" name="Submit" value="提交">
<input type="reset" name="Submit2" value="重置"></td>
</tr>
</form>
</table>
<table border="1">
<tr>
<th>www.dreamdu.com</th>
<th>.com域名的數量</th>
<th>.cn域名的數量</th>
<th>.net域名的數量</th>
</tr>
<tr>
<td>2003年</td>
<td>1000</td>
<td colspan="2">2000+3000</td>
</tr>
<tr>
<td>2004年</td>
<td>4000</td>
<td>5000</td>
<td>6000</td>
</tr>
<tr>
<td>2005年</td>
<td>7000</td>
<td>8000</td>
<td>9000</td>
</tr>
<tr>
<td>總數</td>
<td colspan="3">24000</td>
</tr>
</table>
</body>
</html>
<?php
if(!empty($_POST["Submit"]))
{
$password=$_POST["password"];
$password1=$_POST["password1"];
if($password==$password1)
{
echo "註冊成功!";
}
else
{
echo "兩次輸入的密碼不一致!";
}
}
$_POST是一個數組,裏面包含着所有post到服務器的值,而這些值的名字就是你寫的name名
$a = array ('a' => 'apple', 'b' => 'banana', 'c' => array ('x','y','z'));
print_r ($a);
?>