我正在为excel创建一个导出工具,我的数组存在问题。
当我去打印时,我只看到了A?
代码:
$num = $_POST['num'];
for($i =0; $i< $num; $i++){
$firstname = $_POST['firstnameexport'];
$lastname = $_POST['lastnameexport'];
$email = $_POST['emailexport'];
$phone = $_POST['phoneexport'];
$data = array(
array("firstname" => $firstname[$i] , "lastname" => $lastname[$i], "email" => $email[$i], "phone" => $phone[$i])
);
print_r($firstname[$i]);
}
它会打印出来:
Afirstname lastname email phone
A A A A
值正在通过表单传递
这是代码:
$memberfirstnamearray = array($j => $memberfirstname);
$memberlastnamearray = array($j => $memberlastname);
$memberphonearray = array($j => $memberphone);
$memberemailarray = array($j => $memberemail);
$j++;
$i++;
我和j = 0开始
<input type='hidden' name='firstnameexport' value='$memberfirstnamearray' />
<input type='hidden' name='lastnameexport' value='$memberlastnamearray' />
<input type='hidden' name='emailexport' value='$memberphonearray' />
<input type='hidden' name='phoneexport' value='$memberemailarray' />
<input type='hidden' name='num' value='$j' />
答案 0 :(得分:0)
我需要做的就是在填写表单中的列表后创建会话,如果单击导出按钮,会话将被发送到导出文件,将其转换为excel文件。
感谢所有帮助人员!