0

My problem is that i have to add multiple variables to a array from the same input, first i add 22, after that 23, then 24 etc. How do i do to display them all in a foreach loop?

<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');
Jonathan
  • 49
  • 1
  • 8

1 Answers1

0

try...

$income = $_POST['income'];
$var2 = "";

$arrays = array ($income, $var2);

foreach ( $arrays as $array => $value ) {
//print out array values
//print_r($value);
}
Society43
  • 737
  • 9
  • 12