Need a little help with PHP please Array
I have this script which receives the posted variables and strings them all together in the way I want into $ResultsArray. Perfect
When I use the foreach loop and echo the array it works. Perfect
When I send another lot of the posted variables again and string them all together into $ResultsArray it overwrites the first value so instead of
So instead of getting eg.
0: rubbish
1: garbage
I get:
0:garbage
because it has overwritten rubbish.
PHP Code:
<?PHP
$AuthorBox = $_POST['AuthorBox'];
$TitleBox = $_POST['TitleBox'];
$TitleBox ="<i>$TitleBox</i>";
$YopBox = $_POST['YopBox'];
$PopBox = $_POST['PopBox'];
$PublisherBox = $_POST['PublisherBox'];
$EditionBox = $_POST['EditionBox'];
$ResultsArray[$value] = $AuthorBox.'. ('.$YopBox.'), '.$TitleBox.', ('.$EditionBox.' edition), '.$PopBox.': '.$PublisherBox.'.<BR><BR>';
foreach ($ResultsArray as $key => $value) {
echo ("$key: $value<br>\n");
};
?>
Any thoughts on how to solve this would be very awesome.
Thanks
Bottlebank:confused: