首页 > 代码库 > PHP

PHP

技术分享
 1 <?php
 2     include ‘./header.php‘;
 3     $name = "智能机器人@数码相机@iPhone@劳力士手表";
 4     $price = "14999@2588@5688@999999";
 5     $counts = "1@2@3@4";
 6     $arrayid = explode("@",$name);
 7     $arraynum = explode("@",$price);
 8     $arraycount= explode("@",$counts);
 9     if($_POST[Submit]==true)
10     {
11         $id = $_POST[name];
12         $num = $_POST[counts];
13         $key = array_search($id,$arrayid);
14         $arraycount[$key]=$num;
15         $counts=implode("@",$arraycount);
16     }
17     ?>
18     <table width=580 border=1 cellpadding=1 cellspacing=1 bordercolor=#FFFFFF bgcolor=#c17e50>
19         <tr>
20             <td width=145 align=center bgcolor=#FFFFFF class=STYLE1>商品名称</td>
21             <td width=145 align=center bgcolor=#FFFFFF class=STYLE1>价 格</td>
22             <td width=145 align=center bgcolor=#FFFFFF class=STYLE1>数量</td>
23             <td width=145 align=center bgcolor=#FFFFFF class=STYLE1>金额</td>
24         </tr>
25         <?php
26             for($i=0;$i<count($arrayid);$i++)
27             {
28         ?>
29             <form name="form1_<?php echo $i ?>" method="post" action=‘7-12.php‘>
30             <tr>
31                 <td height=25 align=center bgcolor=#FFFFFF class=STYLE2><?php echo $arrayid[$i]; ?></td>
32                 <td  align=center bgcolor=#FFFFFF class=STYLE2><?php echo $arraynum[$i]; ?></td>
33                 <td  align=center bgcolor=#FFFFFF class=STYLE2>
34                     <input name=‘counts‘ type=‘text‘ id=‘counts‘ value=http://www.mamicode.com/‘<?php echo $arraycount[$i]; ?>‘ size=8>"color: #008080">35                     <input name=‘name‘ type=‘hidden‘ id=‘name‘ value=http://www.mamicode.com/‘<?php echo $arrayid[$i]; ?>‘>"color: #008080">36                     <input type=‘submit‘ name=‘Submit‘ value=http://www.mamicode.com/‘更改‘>            "color: #008080">37                 </td>
38                 <td  align=center class=STYLE2><?php echo $arraycount[$i]*$arraynum[$i]; ?></td>
39             </tr>
40             </form>
41         <?php
42             }
43         ?>
44     </table>
View Code

 

PHP