Dubstaphone
Dubstaphone

Reputation: 420

How do you make an array stay set on reload?

I have a signup form and an array called $errors. When the user submits the form, it checks for errors and adds them to the $errors array. Everything works just fine, except for one thing; when the page loads after being submitted, the array is empty. How can I make this array stay put?

Thanks!

Upvotes: 0

Views: 139

Answers (1)

TomDillinger
TomDillinger

Reputation: 194

You need to post the errors array and then repopulate it from the $_POST data. Alternatively you could write the errors array to a file and then read them in from that file each time + the new errors.

There are probably a couple of other ways but those're the first two I thought of.

Upvotes: 1

Related Questions