阅读背景:

利用COOKIE和SESSION分别写一个购物车

来源:互联网 

1.COOKIE

<?php 
header("content-type: text/html; charset=utf-8");

 ?>
 <!DOCTYPE html>
 <html lang="en">
 <head>
 	<meta charset="UTF-8">
 	<title>COOKIE购物车实现</title>
 	<style>
	img{
		width: 200px;
		height: 200px;
	
	}
 	</style>
 </head>
 <body>
 	<form action="2.php" method="post">
	<table border=1 width="200px" height="200px">
		<tr><th><img src="./img/1.jpg" alt=""><input type="checkbox" value="1" name="shop[]"></th></tr>
		<tr><th><img src="./img/2.jpg" alt=""><input type="checkbox" value="2" name="shop[]"></th></tr>
		<tr><th><img src="./img/3.jpg" alt=""><input type="checkbox" value="3" name="shop[]"></th></tr>
		<tr><th><img src="./img/4.jpg" alt=""><input type="checkbox" value="4" name="shop[]"></th></tr>
		<tr><th><img src="./img/5.jpg" alt=""><input type="checkbox" value="5" name="shop[]"></th></tr>
	</table>
	<input type="submit" value="提交">
 	</form>
 </body>
 </html>
<?php 
header("content-type: text



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: