php session variables not passing!
Permalink 1 user found helpful
I'm sorry if you see this in chit-chat and here. I just realized I should have posted this here.....
I have an html form whom's action=register.php
When you click submit on the html form submit button, register.php is executed. It starts a session like this:
session_start();
Then it creates some sessions variables like this:
$_SESSION['first_name']=$_POST['first_name'];
when that is done, I redirect the user to another page. This last page is where I have the php block in use. So, I edited the page and added the PHP block. Within my php block I tried this:
session_start();
echo "Thank you for registering," . $_SESSION['first_name'];
But, when I register and am redirected to this page, it only displays this on the page: Thank you for registering,
Seems like sessions aren't being passed. I tested this outside of concrete5, just though a basic apache2 site and it works fine.
I hope my explanation made sense
=\ confused
I have an html form whom's action=register.php
When you click submit on the html form submit button, register.php is executed. It starts a session like this:
session_start();
Then it creates some sessions variables like this:
$_SESSION['first_name']=$_POST['first_name'];
when that is done, I redirect the user to another page. This last page is where I have the php block in use. So, I edited the page and added the PHP block. Within my php block I tried this:
session_start();
echo "Thank you for registering," . $_SESSION['first_name'];
But, when I register and am redirected to this page, it only displays this on the page: Thank you for registering,
Seems like sessions aren't being passed. I tested this outside of concrete5, just though a basic apache2 site and it works fine.
I hope my explanation made sense
=\ confused
I haven't worked on this in quite a while, so I don't remember. I got side tracked with other stuff. But, try to sign out of the c5 admin panel, then try this. I think mine had something to do with that....not sure, sorry
What does $_POST have in it?
var_dump($_POST);
don't call session_start(). Concrete already does that.
$_SESSION should work just fine otherwise. I would make sure to prepend a custom variable to the name of your keys, so they don't collide with the keys that concrete5 is using. Maybe "my_custom_form_first_name" instead ?
$_SESSION should work just fine otherwise. I would make sure to prepend a custom variable to the name of your keys, so they don't collide with the keys that concrete5 is using. Maybe "my_custom_form_first_name" instead ?
Bump, no posted fix works for me.
i found that when writing components the session wasn't persistent and variables i set in the header were not available in the footer. The solution i found was to reinition the variables in the footer.
not the most elegant of solutions but it worked.
my guess is that session wise there is a better way of acheiving this ... but when you need solutions ... one that works is better than the RIGHT way that you don't know :)
not the most elegant of solutions but it worked.
my guess is that session wise there is a better way of acheiving this ... but when you need solutions ... one that works is better than the RIGHT way that you don't know :)
Did you allready fixed this?