I'm trying to create an array to store numbers and add them together.
<input type="number" name="numbers[]"/>
I'm getting an undefined variable on the following line
foreach($numbers as $number)
I'm sure this is probably something basic but I'm relatively new to php and help would be greatly appreciated.
If you posted the input
s you're showing from one page to another and you need to run through the list you should set it up like this:
if (isset($_REQUEST['numbers']) && is_array($_REQUEST['numbers'])) {
$numbers = $_REQUEST['numbers'];
foreach ($numbers as $number) {
print $number;
}
}