|
发表于 2011-11-16 13:42:00
|
显示全部楼层
由于我也是新手,所以写的麻烦了很多……大概方法就是这样的,代码你再优化下
php提交页面代码:
PHP复制代码
$data = $_POST;
$one = '';
$two = '';
$three = '';
for ($i=0;$i<4;$i++)
{
if ($data['cate'][$i] == 'one')
{
$one = $one.$i.',';
}
if ($data['cate'][$i] == 'two')
{
$two = $two.$i.',';
}
if ($data['cate'][$i] == 'three')
{
$three = $three.$i.',';
}
}
$one = substr($one,0,strlen($one)-1);
$two = substr($two,0,strlen($two)-1);
$three = substr($three,0,strlen($three)-1);
//echo $one."<br />".$two."<br />".$three."<br />";
$one = explode(",",$one);
$two = explode(",",$two);
$three = explode(",",$three);
复制代码
HTML输出页面代码:
HTML复制代码
<table border="solid,1px">
<tr>
<td>one </td>
<td>two </td>
<td>three </td>
</tr>
<tr>
<td><?=$data['text'][$one[0]];?></td>
<td><?=$data['text'][$two[0]];?></td>
<td><?=$data['text'][$three[0]];?></td>
</tr>
<tr>
<td><?=$data['text'][$one[1]];?></td>
<td><?=$data['text'][$two[1]];?></td>
<td><?=$data['text'][$three[1]];?></td>
</tr>
<tr>
<td><?=$data['text'][$one[2]];?></td>
<td><?=$data['text'][$two[2]];?></td>
<td><?=$data['text'][$three[2]];?></td>
</tr>
<tr>
<td><?=$data['text'][$one[3]];?></td>
<td><?=$data['text'][$two[3]];?></td>
<td><?=$data['text'][$three[3]];?></td>
</tr>
</table>
复制代码
|
|