21,887
社区成员
发帖
与我相关
我的任务
分享
<html>
<head>
<title>Dodgy Health Insurance - Premium Calculator</title>
<link href="styles.css" rel="stylesheet">
</head>
<head></head>
<body>
Dodgy Health Insurance - Premium Calculator
<br>Welecome to Dodgy Health Insurance.Complete the form below to calculate the annual premium you would pay for one of our packages.
<FORM action="cost.php" METHOD=post>
First name:<INPUT TYPE=TEXT NAME="fname"><BR>
Last name:<INPUT TYPE=TEXT NAME="lname"><BR>
Phone number:<INPUT TYPE=TEXT NAME="pnumber"><BR>
Hospital cover: <br>
<INPUT TYPE=RADIO NAME="hospital" VALUE="Individual">Individual<br>
<INPUT TYPE=RADIO NAME="hospital" VALUE="Couple">Couple<br>
<INPUT TYPE=RADIO NAME="hospital" VALUE="Family">Family <br>
Extra health cover: <br>
<INPUT TYPE=CHECKBOX NAME="extra[]" VALUE="Dental">Dental<br>
<INPUT TYPE=CHECKBOX NAME="extra[]" VALUE="Optical">Optical<br>
<INPUT TYPE=CHECKBOX NAME="extra[]" VALUE="Physiotherapy">Physiotherapy<br>
<INPUT TYPE=CHECKBOX NAME="extra[]" VALUE="Clinical psychology">Clinical psychology<br>
<INPUT TYPE=CHECKBOX NAME="extra[]" VALUE="Other therapies ">Other therapies <br>
<INPUT TYPE=HIDDEN NAME="cost" VALUE= "cost"><br>
<INPUT TYPE=SUBMIT VALUE= "Submit"><INPUT TYPE=reset VALUE= "Reset">
</FORM>
</body>
</html>
create database assignment2;
use assignment2;
create table Instructor(
instructor_id int(10) not null auto_increment,
instructor_name varchar(30),
instructor_phone varchar(30),
primary key(instructor_id)
);
insert into Instructor values('','Kerry Walters','5294 1140');
insert into Instructor values('','John Jacobson','5407 1006');
insert into Instructor values('','Jessica Cameron','5499 7387');
insert into Instructor values('','Bruce Phillips','5314 4212');
create table course(
course_id int(10) not null auto_increment,
course_name varchar(30),
instructor_id int(10),
course_start datetime,
course_weeks bigint,
course_cost decimal(5,2),
primary key(course_id)
);
insert into course values('','Introductory Pottery',3,' 2009-11-09',6,180.00);
insert into course values('','Cake Decorating',1,' 2009-10-26',8,240.00);
insert into course values('','Advanced Pottery',3,' 2010-01-11',6,180.00);
insert into course values('','Introductory Photography',4,' 2009-20-26',6,150.00);
insert into course values('','Advanced Photography',4,'2010-01-18',6,150.00);
insert into course values('','Signwriting',2,'2010-01-11',8,240.00);
Grant all
On assignment2
To mmst12009 identified by "mmst12009"
<?php
$firstName=$_POST['fname']; //First name
$lastName=$_POST['lname'];//Last name
$phoneNumber=$_POST['pnumber'];//Phone number
$hospitalCover=$_POST['hospital'];//Hospital cover
$extraHealthCover=$_POST['extra'];//Extra health cover
echo $firstName."<br>";
echo $lastName."<br>";
echo $phoneNumber."<br>";
echo $hospitalCover."<br>";
print_r($extraHealthCover);
?>
else if ($hospital=="Family"){
$total= 2500 + (50 * $count) * 3;
echo "You paid a total " . $total; //家庭
}
else if ($hospital=="Family"){
$total= 3200 + (50 * $count) * 3;
echo "You paid a total " . $total; //家庭
}
<?php
@$fname=$_POST["fname"];
@$lname=$_POST["lname"];
@$pnumber=$_POST["pnumber"];
@$hospital=$_POST["hospital"];
@$extra=$_POST["extra"];
if ($fname=="" or $lname=="" or $pnumber=="" or $hospital==""){ //资料没有填写完整
echo "Provide you with incomplete information";
exit();
}
if ($extra==""){ //计算一共选了多少项附加
$count=0;
}else{
$count = count($extra);
}
if ($count==0){
echo "You selected no extra cover <br>"; //提示不用支付其它项
}
if ($hospital=="Individual"){ //判断是以那种身份参加医疗保险
$total= 1300 + 50 * $count;
echo "You paid a total " . $total; //个人
}else if ($hospital=="Couple"){
$total= 2500 + (50 * $count) * 2;
echo "You paid a total " . $total; //夫妻
}else if ($hospital=="Family"){
$total= 2500 + (50 * $count) * 3;
echo "You paid a total " . $total; //家庭
}
?>
$arr_chk=$_POST['extra'];
$str_rdo=$_POST['hospital'];
print_r($arr_chk);//数组
echo $str_rdo;//string