WEB第二次实验报告Word文档格式.doc
《WEB第二次实验报告Word文档格式.doc》由会员分享,可在线阅读,更多相关《WEB第二次实验报告Word文档格式.doc(8页珍藏版)》请在冰点文库上搜索。
计算机学院
专业
软件工程
实验类型
课内
实验学时
2
2015.5.13
一、实验目的和要求
实验目的:
1.通过上机实验,熟悉Apache服务器的安装和配置使用方法。
2.掌握php脚本语言,熟练运用php语言进行服务端编程。
二、实验环境(实验设备)
EditPlus
三、实验原理及内容
<
head>
<
metacharset="
UTF-8"
>
metaname="
Generator"
content="
EditPlus®
"
Author"
steacymar"
Keywords"
Description"
title>
Welcometobookseller<
/title>
<
/head>
body>
formaction="
Welcome.php"
method="
post"
h1>
fontface="
黑体"
Youarewelcome<
/font>
/h1>
table>
<
tr>
<
td>
pleaseinputyourname:
/td>
inputtype="
text"
name="
name"
/>
/tr>
pleaseinputyouraddress:
address"
pleaseinputyourzip:
zip"
/table>
p>
pleasefillinthequantityfieldofthefollowingform:
/p>
<
tableborder="
border"
th>
book<
/th>
publisher<
price<
quantity<
Webtechnology<
Springerpress<
$5.0<
wt"
/>
mathematics<
ACMpress<
$6.2<
mm"
principleofOS<
Sciencepress<
$10<
pOS"
Theoryofmatrix<
Higheducationpress<
$7.8<
tom"
paymentmethod:
radio"
name="
payment"
value="
cash"
checked="
checked"
cash
cheque"
cheque
creditcard"
creditcard
submit"
Submit"
reset"
Reset"
/form>
/body>
/html>
Welcome.php
html>
customername:
?
phpecho$_POST["
];
?
/br>
customeraddress:
customerzip:
totalcost<
php
functiontotal($price,$quantity)
{
$total=$price*$quantity;
return$total;
}
?
php
if($_POST["
]!
=0)
echo"
<
"
.total(5,$_POST["
])."
;
if($_POST["
=0)
echo"
.total(6.2,$_POST["
.total(10,$_POST["
.total(7.8,$_POST["
}
?
<
<
]."
hasbought"
.($_POST["
]+$_POST["
books."
$sum=5*$_POST["
]+6.2*$_POST["
]+10*$_POST["
]+7.8*$_POST["
echo$_POST["
paid"
.$sum."
."
?
paidby<
$file=fopen("
test.txt"
"
w+"
);
fwrite($file,$_POST["
hasbought"
books.\r\n"
.\r\n"
fwrite($file,"
paidby"
.$_POST["
fclose($file);
四、实验结果
五、指导教师评语
成绩
批阅人
日期
-7-