我的问题是我必须从同一个输入向数组中添加多个变量,首先我添加22,然后是23,然后是24等。我该如何在foreach循环中显示它们?
<input type="text" name="income">
<?php
$cost = array();
array_push($cost,$_COOKIE['income']);
$income = $_POST['income'];
$date = date("Y-m-d");
foreach($cost as $tmpcost)
{
echo $tmpErrors . "<br />";
}
header('location:index.php');
答案 0 :(得分:0)
尝试...
$income = $_POST['income'];
$var2 = "";
$arrays = array ($income, $var2);
foreach ( $arrays as $array => $value ) {
//print out array values
//print_r($value);
}