作业:Web应用技术 动态网站

来源:互联网 发布:win7 tcp监听端口阻塞 编辑:程序博客网 时间:2024/06/05 09:02

实验要求:

实验1:网上购物订单制作 

写一个简单的PHP程序实现网上购物订单的基本功能:将客户在Shopping.html页面中输入的联系方式和邮寄地址等信息内容读取出来且显示在另一页面Shopping.jsp中。

实验2:简单购物车的实现 

写一个简单的phP程序实现网上购物车的基本功能:即向购物车添加或者删除商品,并给出购物车中的商品信息和总金额。

实验代码:

实验1

Shopping.html;

<html>  
<head>
<title>shopping</title> 
<script language="JavaScript">
</script>
<html> 
<center>
       <form name="form1" method="post" action="shopping.php"> 
姓        名:      <input type="text" name="username" /> <br/>
联系方式: <input type="text" name="contact"/> <br/>
电子邮件: <input type="text" name="email" /> <br/>
  <td width="80"><input name="submit2" type="submit" onClick="tosubmit2()" value="点击保存" /></td>
        <td width="122"><input name="Submit3" type="reset" class="btn_grey" value="重 置" /></td>
       </form> 
</center>
</html> 
</body>

</html>

Shopping.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>接收值2</title>
</head>
<script type="text/javascript">
<?php

$wu = $_POST['username'];
$wu2 = $_POST['contact'];
$wu3 = $_POST['email'];?>

</script>
<body>
<table width="365" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#C2C2C2">
 <tr><th>姓    名:<?php echo $wu; ?></th></tr>
 <tr><th>联系方式:<?php echo $wu2;?></th></tr>
 <tr><th>电子邮箱:<?php echo $wu3;?></th></tr>
</table>
</body>
</html>

实验2:见 http://download.csdn.net/detail/tebin123/9572742


0 0