2

i have a user class with a function to add a user.

i also have a form that triggers an ajax call on submit which passes a query string for the username and potentially other information to the controller.

everytime the controller gets called via ajax, it creates a new instance of my user class and calls the add user function by passing the query strings as parameters.

is there a way where i can output an array of usernames that have been submitted without storing it in a sessions.

1
  • Store it in the database or filesystem. Commented Nov 29, 2012 at 0:04

2 Answers 2

1

I use a global variable to indicate I'm currently in AjAX mode. So when you call the AJAX controller set a global variable.

Then just skip the add user function by checking to see if the global variable is defined.

Sign up to request clarification or add additional context in comments.

Comments

0

Your options are to store it:

  1. In a session.
  2. In a file.
  3. In a database.

PHP is not a persistent service, and will not remember anything between requests other than what has been stored either in a session, or in an external store.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.