I am having a bit of a brain freeze today. I am writing a function, and as part of the function, I want a counter to be incriminated, and a record added to my function. This should run after a form is submitted, so it checks how many name/email combos have been submitted, and ads them to the array accordingly.

The code I have, looks like this

Code PHP:
$people = array();
	function writeArray($name,$email){
		echo $i;
		$people[$name] = $email;

So if in the form, I enter a name into both name 1 and 2 fields, I'll get output like this:

1Array ( [Dan Smith] => dan.smith@example.com )
1Array ( [Joe Blow] => joe@blow.com )
It seems to not save the previous name, and just creates a new array with 1 user. The counter is also not incremented. How can I get my counter to show 2, and both of these gentlemen's names to be shown?