Ez all,
I'm trying get a simple form to add to an array.
All I want to do is send a name from a form field into an array. And then progressively add more and more names into the same array buy entering and submitting them in the form.
I've thought long and hard about it but everytime i submit a new name it just replaces the old name with the new name rather than adding it to the names already stored.
This is what ive done but even I can see this is not right... Please help...
<form method="POST" action="<?php echo $PHP_SELF ?>">
<input type="hidden" name="action" value="add">
Name<input type="text" name="name2" size="20">
<input type="submit" value="Submit" name="B1">
</form>
<?
$store_info[] = "";
while(list($ElementIndexValue, $ElementContents) = each($store_info))
{
echo "<br> $ElementIndexValue - $ElementContents";
}
function add_array()
{
global $PHP_SELF, $name2, $store_info;
$numrow = count($store_info);
$store_info[$numrow] = $name2;
}
if($action == "add")
{
add_array();
}
?>