<?php
header(
"Content-Type:text/html; charset=utf-8"
);
$name
=
"智能机器人@数码相机@天翼 3G 手机@瑞士手表"
;
$price
=
"14998@2588@266@66698"
;
$counts
=
"1@2@3@4"
;
$arrayid
=
explode
(
"@"
,
$name
);
$arraynum
=
explode
(
"@"
,
$price
);
$arraycount
=
explode
(
"@"
,
$counts
);
if
(
$_POST
){
$id
=
$_POST
[
"name"
];
$num
=
$_POST
[
"counts"
];
$key
=
array_search
(
$id
,
$arrayid
);
$arraycount
[
$key
]=
$num
;
$counts
= implode(
"@"
,
$arraycount
);
}
?>
<table width=
"580"
border=
"1"
cellpadding=
"1"
cellspacing=
"1"
bordercolor=
"#FFFFFF"
bgcolor=
"#c17e50"
>
<tr>
<td width=
"145"
class
=
"STYLE1"
align=
"center"
bgcolor=
"#FFFFFF"
>商品名称</td>
<td width=
"145"
class
=
"STYLE1"
align=
"center"
bgcolor=
"#FFFFFF"
>价 格</td>
<td width=
"145"
class
=
"STYLE1"
align=
"center"
bgcolor=
"#FFFFFF"
>数 量</td>
<td width=
"145"
class
=
"STYLE1"
align=
"center"
bgcolor=
"#FFFFFF"
>金 额</td>
</tr>
<?php
for
(
$i
=0;
$i
<
count
(
$arrayid
);
$i
++) {
?>
<form name=
"form_<?php echo $i ?>"
method=
"post"
action=
"2.php"
>
<tr>
<td height=
"25"
class
=
"STYLE2"
align=
"center"
bgcolor=
"#FFFFFF"
><?php
echo
$arrayid
[
$i
]; ?></td>
<td
class
=
"STYLE2"
align=
"center"
bgcolor=
"#FFFFFF"
><?php
echo
$arraynum
[
$i
]; ?></td>
<td
class
=
"STYLE2"
align=
"center"
bgcolor=
"#FFFFFF"
>
<input name=
"counts"
type=
"text"
id=
"counts"
value=
"<?php echo $arraycount[$i]; ?>"
size=
"8"
>
<input name=
"name"
type=
"hidden"
id=
"name"
value=
"<?php echo $arrayid[$i]; ?>"
>
<input name=
"Submit"
type=
"submit"
value=
"更改"
>
</td>
<td
class
=
"STYLE2"
align=
"center"
><?php
echo
$arraycount
[
$i
] *
$arraynum
[
$i
]; ?></td>
</tr>
</form>
<?php
}
?>
</table>