📄 confirm.php.txt
字号:
<html>
<head>
<title>Index</title>
</head>
<body>
<h2 align="center">User Registration Confirmation page.</h2>
<form name="registration" method="post" action="output.php" enctype="multipart/form-data">
<table width="300" border="1" align="center" cellpadding="5" cellspacing="0" bgcolor="#EEEEFF">
<tr>
<td width="47%" align="right"> <B> Full Name </B> </td>
<td >
//--- Validating the name Input value.
<?php
if(empty($name))
{
die(" No Name submitted");
}
//--- Validating whether the length of the name Input value Is between 5 to 50 characters.
elseif ( (strlen($name) < 5) || (strlen($name) > 50))
{
die("Invalid name");
}
else
{
//--- Printing the name Input value.
echo $name;
}
?>
</td>
</tr>
<tr>
<td width="47%" height="57" align="right"><B> Address </B></td>
<td height="57">
//--- Validating Value in the Address Text field
<?php
if(empty($address))
{
die(" No address submitted");
}
elseif ( (strlen($address) < 5) || (strlen($address) > 50))
{
die("Invalid address");
}
else
{
echo $address;
}
?>
//--- Validating Value in the e-mail text field
</td>
</tr>
<tr>
<td width="47%" align="right"> <B>email</B> </td>
<td height="2">
<?php
if(empty($email))
{
die(" No email address submitted");
}
elseif ( (strlen($email) < 5) || (strlen($email) > 50))
{
die("Invalid email address, email address too long or too short.");
}
elseif(!ereg("@",$email)) //refer to php manual 4 ereg expln.
{
die("Invalid email address, no @ symbol found");
}
else
{
echo $email;
}
?>
</td>
</tr>
<tr>
<td width="47%" align="right"> <B>password </B></td>
<td height="2">
//--- Validating Value in the Password Text field
<?php
if(empty($password) || empty($cpassword))
{
die(" No password submitted");
}
elseif ( ((strlen($password) < 5) || (strlen($password) > 15)))
{
die("Invalid password length address");
}
//--- Comparing values of the Password and Confirm Password fields.
elseif ( !(strlen($password) == strlen($cpassword)) )
{
die(" Passwords do not match ! ");
}
elseif( !($password === $cpassword)) //compares values and datatypes
{
die(" Passwords do not match ! ");
}
else
{
for ($i=0;$i<strlen($password);$i++)
{
echo "*";
}
}
?>
</td>
</tr>
<tr>
<td width="47%" align="right"> DoB </B></td>
<td height="2">
//--- Validating Input values of the birthday fields
<?php
if (empty($birth_month) || empty($birth_day) || empty($birth_year) )
{
die(" Date of birth not submitted or incomplete.");
}
switch($birth_month)
{
case 1: print "January "; break;
case 2: print "February "; break;
case 3: print "March ";break;
case 4: print "April ";break;
case 5: print "May "; break;
case 6: print "June "; break;
case 7: print "July "; break;
case 8: print "August "; break;
case 9: print "September "; break;
case 10: print "October "; break;
case 11: print "November "; break;
case 12: print "December "; break;
default: die("Invalid birth month !!");
}
if (($birth_day < 1) || ($birth_day > 31))
{
die(" Invalid date !");
}
else
{
echo $birth_day, " ";
}
if (($birth_year < 1900) || ($birth_year >2000))
{
die("Invalid birth year");
}
else
{
echo $birth_year;
}
?>
</td>
</tr>
<tr>
<td width="47%" align="right">
Gender
</td>
<td height="2" width="26%">
//--- Validating the value of a Radio button control
<?php
if (empty($gender))
{
die(" Gender not specified");
}
elseif (!(($gender=="Male") || ($gender=="Female")))
{
die("Invalid value for gender");
}
else
{
echo $gender;
}
?>
</td>
</tr>
<tr>
<td width="47%" align="right">
<B> Topics of interests</B>
</td>
<td height="2" colspan="2">
<table width="100%" border="0">
<tr>
<td>
//--- Validating Value of a check box form control
<?php
if ($fiction)
{
echo "fiction <br>";
}
if ($horror)
{
echo "horror <br>";
}
if ($action)
{
echo "action <br>";
}
if ($comedy)
{
echo "comedy <br>";
}
if ($thrillers)
{
echo "thrillers <br>";
}
?>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="47%" height="47" align="right">
<B> Select hobbies</B>
</td>
<td colspan="2" height="47">
<p align="center">
<?php
for ($i=0; $i<count($hobbies);$i++)
{
echo $hobbies[$i] . "<br>";
}
?>
</td>
</tr>
<tr>
<td colspan="3">
<FORM Name=confirm action="output.php">
//--- Printing Hidden field values
<?php
echo "<input type=hidden name=\"name\" value=\"".$name."\" >\n";
echo "<input type=hidden name=\"address\" value=\"".$address."\" >\n";
echo "<input type=hidden name=\"email\" value=\"".$email."\" >\n";
echo "<input type=hidden name=\"birth_month\" value=\"".$birth_month."\" >\n";
echo "<input type=hidden name=\"birth_day\" value=\"".$birth_day."\" >\n";
echo "<input type=hidden name=\"birth_year\" value=\"".$birth_year."\" >\n";
echo "<input type=hidden name=\"interests\" value=\"".$interests."\" >\n";
for ($i=0;$i<count($hobbies);$i++)
{
echo "<input type=hidden name=\"hobbies[]\" value=\"".$hobbies[$i]."\" >\n";
}
if ($fiction)
{
echo "<input type=hidden name=\"fiction\" value=\"".$fiction."\" >\n";
}
if ($action)
{
echo "<input type=hidden name=\"action\" value=\"".$action."\" >\n";
}
if ($horror)
{
echo "<input type=hidden name=\"horror\" value=\"".$horror."\" >\n";
}
if ($comedy)
{
echo "<input type=hidden name=\"comedy\" value=\"".$comedy."\" >\n";
}
if ($thrillers)
{
echo "<input type=hidden name=\"thrillers\" value=\"".$thrillers."\" >\n";
}
?>
<center> <input type="submit" name="Submit" value="Confirm >>">
</center>
</form>
</td>
</tr>
</table>
</form>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -