Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problems with arrays

Status
Not open for further replies.

MrPantsTm

Programmer
Joined
Jan 22, 2004
Messages
71
Location
US
On one of my pages I declare an array to null. I then use several forms. The first form puts information into the array and the user clicks submit. But I guess when it submits, it reloads the page and redeclares the array and I loose whatever was put in the array. Is there a way to #define the array so that php doesn't keep redeclaring it or is there another work around? I'm doing each form in an include file but that shouldn't make a difference. thanks.
 
Then I'm confused. Web apps are discontinuous.

Web scripts run and output HTML, then the run of the script stops. The browser renders the HTML, the user fills in and submits the form. The browser sends the input to the web browser which then runs the script and passed the user's input to the script.

If you want to keep information between runs of scripts, I recommend you use PHP's session variables


Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Let me try to explain this better (and perhaps this might clear it in my mind too).

I'm trying to make a list of players. I figured I'd use an array for this.

the first form I want to know who is part of the game.

the second form I want to specify the order.

the first form works fine. The second form however gets an empty array. I assume this is because the page was sent again and run and the array was intialized again.

At the moment I use one page and use includes that are controlled by if statements. Should I use multiple pages and if so how would I pass the array? Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top