---
title: "How can we register the variables into a session?"  
description: "How can we register the variables into a session?"  
author: "shane  watson"  
published: 2018-06-12  
canonical: https://answers.mindstick.com/qa/44783/how-can-we-register-the-variables-into-a-session  
category: "jobs & education"  
tags: ["php programming"]  
reading_time: 1 minute  

---

# How can we register the variables into a session?

How can we [register](https://www.mindstick.com/blog/220/registering-client-script-in-asp-dot-net) the [variables](https://www.mindstick.com/articles/715/php-variables) into a [session](https://www.mindstick.com/articles/12042/session-in-c-sharp)?\

## Answers

### Answer by Prakash nidhi Verma

**PHP Session :** if you work on any application,you just open it,do some changes according to you,and close it.This whole process is much like a session.after that if you again wants to do work here than on the internet there is one problem because your application end and the web server does not know who you are and what you do even HTTP address doesn't maintain state. it's only one time service for one user as a session variables hold information. if you need permanent storage, you may to a big database. <?php session_start(); // Starting session $_SESSION["firstname"] = "Mind"; // Storing session data $_SESSION["lastname"] = "Stick"; ?> you should follow these steps for your problem: -> session_start(); -> session_register(); never use this syntax only use this $_SESSION['foo'] = 'bar'; -> session_destroy(); I Hope, it will be helpful for you.happy coding :)


---

Original Source: https://answers.mindstick.com/qa/44783/how-can-we-register-the-variables-into-a-session

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
