The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Arrays/variables don't write inside function?

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.

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?

This is what's called scope. The $i and $people in your function are local variables. They are not the $i and $people you're using outside of the function. The variables are in different scopes; literally, they are part of two different symbol tables for the interpreter. If you want to modify them, either pass them in by reference, or make the pair a return value.

You can bring the other variables into scope by making them globals, but unnecessary use of global variables leads to messy, hard to maintain code.