I am trying to create a simple form which will allow me to add the values from the form to the a list or array and then display them on the same page.
I also need to be able to keep adding to this list on the same page and not loose the previously added values.
At present when I add something using the following method it displays fine on the page but if I add another one it overwrites what is already there.
$support_list = array();
echo "<form method='post' name='support'>";
echo "<textarea name='support' rows='6' cols='69'></textarea>";
echo "<input type='submit' name='s_submit'>";
echo "</form>";
if($_POST['s_submit']) {
$s=array("test7"=>$_POST['support']);
array_push($support_list,$s);
}
print_r($support_list);
Here is the output on the page.
Ideally I would want something like this, and each time you click the submit button it keeps adding to the array, the end goal is to use the values in that array to write to a DB instead of doing it one at a time.
Array ( [0] => Array ( [test7] => Hello Test Adding ), [1] => Array ( [test8] => Hello Test Adding 1 ) )