This is driving me nuts!!!
I am passing a text array from a form to another file and trying to display the data. I have reduced the process to it's simplest form and still can not make it work.

FormSend.php:

<?php
	echo '<form method="post" action="FormRecieve.php" name="Activate">
    <input type="text" name="fruit[]" value="apple"/>
    <input type="text" name="fruit[]" value="banana"/>
    <input type="text" name="fruit[]" value="cherry"/>';
	echo '<button value="sub" name="submit">Submit</button><br>';
	echo '</form>';
?>

FormRecieve.php

<?php
foreach($_POST as $field => $value) 
{ 
echo $field, $value;
echo "<br />";
}
?>

The result that get is:
fruitArray
submitsub

What the heck am I doing wrong?????

Recommended Answers

All 3 Replies

Welcome Spidermite.

<?php
foreach($_POST['fruit'] as $field => $value) 
{ 
echo $field, $value;
echo "<br />";
}
?>

Yes, that is it.
Thankyou thankyou thankyou.
I can stop beating my head on the floor now. My pulse is going down.

Thanks:icon_biggrin:

Thanks.

Mark this thread as Solved if you get solution.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.