Jump to content

Passing variables


pritam79

Recommended Posts

For what purpose? Under what conditions must the data be preserved? There's no single best way to use any of the things you mention. They all have their place, but for different purposes.Session is best used for estabilishing "per user connection" information, which will often be preceded by a log in. This forum for example uses a session variable to keep track of the current page you're on. The session cookie itself helps identify if you have the rights to view/edit/create whatever it is you're viewing/editing/creating.Cookie is best used for estabilishing non-critical per computer preferences. Some sites for example use cookies to store language and theme preferences. They do so instead of sessions to avoid making users log on, and make the preferences valid for longer periods of time while still letting actual users log in securely.POST (form) data is best used for data that is entered NOW, and must be acted upon NOW, and only ONCE. For example, when you post a reply, you're posting via the POST method.GET (URL) data is best used for data that has been entered NOW, but must be acted upon NOW and EVERYTIME the equivalent data is entered. For example, to refer back to this topic, this forum uses a URL variable that specifies the forum topic to load.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...