表单1:
while($data = mysql_fetch_assoc($query))
{
....
echo "<td><input type='radio' value='".$data['jns']."' name='tes[".$data['kode]."]' /></td>";
....
}
表单2:
$kode = $_POST['tes'];
$temp[] = $kode;
$_SESSION['kd'] = $temp;
$jum_array=count($_SESSION['kd']);
for($i=0;$i<$jum_array;$i++){
$nilai=$_SESSION['kd'][$i];
echo $nilai;
}
结果不显示任何内容,只显示帖子“array”。
请帮助我。
答案 0 :(得分:0)
$ nilai不是字符串,它是数组:
$kode = $_POST['tes'];
$temp[] = $kode;
$_SESSION['kd'] = $temp;
$jum_array=count($_SESSION['kd']);
for($i=0;$i<$jum_array;$i++){
$nilai=$_SESSION['kd'][$i];
foreach($nilai as $k=>$v){
echo $nilai[$k] ;
///or echo $v;
}
}