Add item to an array
Posted: Tue Feb 10, 2009 4:20 pm
I'm fairly new to PHP, and am having trouble adding items to an array from an html form.
What I'm trying to do is allow my users to search for an item, and when they find that item, have it POST to the same page, and add that item to an array. I also want to be able to do this many times to add multiple items to the array. I can currently add one item to the array with using POST, but when I try adding subsequent items it overwrites my array each time the page loads and thus erases any previous item.
Is there a way to do this with just PHP or will I need to use a database or javaScript to facilitate this? Thanks in advance for the help!
What I'm trying to do is allow my users to search for an item, and when they find that item, have it POST to the same page, and add that item to an array. I also want to be able to do this many times to add multiple items to the array. I can currently add one item to the array with using POST, but when I try adding subsequent items it overwrites my array each time the page loads and thus erases any previous item.
Is there a way to do this with just PHP or will I need to use a database or javaScript to facilitate this? Thanks in advance for the help!