简体   繁体   English

如何从表单发布数组?

[英]how to posting array from a form?

form 1 : 表格1:

while($data = mysql_fetch_assoc($query))
{
     ....  
     echo "<td><input type='radio' value='".$data['jns']."' name='tes[".$data['kode]."]' /></td>";
     ....             
}

form 2 : 表格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;
}

the results do not display anything, only show posts "array". 结果不显示任何内容,仅显示帖子“数组”。

Please help my case. 请帮我的忙。

$nilai is not string, it is array: $ 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;
    }

}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM