eldan88 Posted March 21, 2014 Share Posted March 21, 2014 Hey Guys. I am trying to see if my page retrieved the $_SESSION['store_name'] in the checkout_class_model.php page In my validation class I set the $_SESSION['store_name'] to be assigned to the $store_name property in the __construct method. I then tried to do a var_dump on the store_name property, but didn't seem to work. Below is my class. Thanks in advanced! class validation { public $store_name = ""; public function __construct() { // Automically checks if store is closed if (is_store_closed()) { goto_page($store_name); //Sets to session store_name $this->store_name = $_SESSION["store_name"]; var_dump($this->store_name); } The validation class is then included in my form.php page Quote Link to comment https://forums.phpfreaks.com/topic/287159-need-help-doing-a-var_dump-on-a-property/ Share on other sites More sharing options...
Solution denno020 Posted March 21, 2014 Solution Share Posted March 21, 2014 The first thing I notice is that the if statement doesn't seem to have it's closing curly brace? Apart from fixing that, there are 3 things I would check: 1. var_dump() as the very first thing in the constructor, this will tell you if the object is being instantiated or not (speaking of which, can you show us the code where you create a new validation class) 2. var_dump() is_store_closed() outside of the if statement, to make sure that's returning true. 3. var_dump() the $_SESSION variable, even though doing a var_dump of $this->store_name should display null. I think you problem is either you haven't created a new class properly (you can't just include the script, you actually have to call $validation = new validation() ), or you is_store_closed() function is returning false. Hope that helps. Denno Quote Link to comment https://forums.phpfreaks.com/topic/287159-need-help-doing-a-var_dump-on-a-property/#findComment-1473488 Share on other sites More sharing options...
eldan88 Posted March 23, 2014 Author Share Posted March 23, 2014 Hey Denno! Thanks for the reply! You where right I was missing a closing curly brace. Good catch! I went ahead and added it. I also did a var_dump on just the session , which it displayed. I then did a car dump on the $this->store_name and it also worked. Thank you very much for your help. I really appreciate it!!! Quote Link to comment https://forums.phpfreaks.com/topic/287159-need-help-doing-a-var_dump-on-a-property/#findComment-1473578 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.