一个PHP的用户注册表单,负责接收用户输入的注册信息,点提交按钮后,显示刚刚提交的信息。
1,html部分
用户注册-www.jbxue.comUser Registration Form
Name | ||||||||
Address | ||||||||
Date of Birth | January February March April May June July August September October November December 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 (Year) | |||||||
Gender | Male | Female | ||||||
Music Preference |
| |||||||
2,接收用户注册信息 userReg.php。
用户注册--www.jbxue.comDear
$name = $_POST['name'];
$address = $_POST['address'];
$birth_month= $_POST['birth_month'];
$birth_day = $_POST['birth_day'];
$birth_year = $_POST['birth_year'];
$gender = $_POST['gender'];
$pop = $_POST['pop'];
$jazz = $_POST['jazz'];
$rock = $_POST['rock'];
$metal = $_POST['metal'];
$instrumental = $_POST['instrumental'];
if ($gender=='M') {
echo "Mr.";
} elseif ($gender=='F') {
echo "Ms.";
}
echo " ", $name;
?> ! 您的输入信息如下:
Address | |
Date of Birth | |
请检查注册信息: if (!(empty($pop))) { if ($pop==1){ echo " Pop "; } } if (!(empty($jazz))) { if ($jazz==1) { echo " Jazz "; } } if (!(empty($rock))) { if ($rock==1){ echo " Rock "; } } if (!(empty($instrumental))) { if ($instrumental==1) { echo " Instrumental "; } } if (!(empty($metal))) { if ($metal==1){ echo " Metal "; } } ?> |