Neno
12-10-2008, 07:17 PM
Ok, it must be that I am tired as I can not figure out the simple thing that I have done so many times. FOREACH.
In my simple example, all I want is to print out all the values from the array.
<form action="testarray.php" method="post">
<input type="text" name="toolname[]"><br />
<input type="text" name="toolname[]"><br />
<input type="text" name="toolname[]">
<input type="submit" name="submit" value="submit"></form>
$toolname = $_POST['toolname'];
print_r($toolname);
foreach ($toolname as $value) {
echo '<p>' . $toolname[$value] . '</p>';
The Array prints out fine but the foreach part doesn't work...
And I have no idea why my php code appears on one long line in this post, sorry.
In my simple example, all I want is to print out all the values from the array.
<form action="testarray.php" method="post">
<input type="text" name="toolname[]"><br />
<input type="text" name="toolname[]"><br />
<input type="text" name="toolname[]">
<input type="submit" name="submit" value="submit"></form>
$toolname = $_POST['toolname'];
print_r($toolname);
foreach ($toolname as $value) {
echo '<p>' . $toolname[$value] . '</p>';
The Array prints out fine but the foreach part doesn't work...
And I have no idea why my php code appears on one long line in this post, sorry.