This topic is locked
[SOLVED]

 Session Variables

9/27/2017 7:25:25 AM
PHPRunner General questions
A
Andrew S author

I would be grateful if anyone could assist with an issue I am having with session variables - everything worked fine using php runner 6 but now I using 9.8 and not working.
I have an order input page created with php runner which works fine. Once the order has been placed, I redirect to a confirmation page giving the details of the order (confirm.php) but the session variables do not get carried over.
For debugging purposes, I have commented out
//header("Location: confirm.php");

//exit();
and added var_dump($_SESSION);
This returns me to the order page saying record successfully added and shows the following at the top of the page showing me the values of all session variables
array(33) { ["myqsladdress"]=> string(9) "127.0.0.1" ["MyURL"]=> string(20) "/orders2017/menu.php" ["OwnerID"]=> NULL ["orders2017_search"]=> int(0) ["FullName"]=> string(14) "Andrew R Stone" ["OrderID"]=> int(170019) ["Turkey"]=> string(46) "White Turkey - 4.98 kg (11.0 Lb) - Price 55.89" ["TurkeyPrice"]=> string(6) " 55.89" ["OrderLine1"]=> string(0) "" ["OrderLine1_price"]=> bool(false) ["Leg"]=> string(17) "Leg of Pork Joint" ["LegQty"]=> string(0) "" ["LegPrice"]=> float(0) ["Gammon"]=> string(15) "Joint of Gammon" ["GammonQty"]=> string(0) "" ["GammonPrice"]=> float(0) ["Sausage"]=> string(18) "Pack of 9 Sausages" ["SausageQty"]=> string(0) "" ["SausagePrice"]=> float(0) ["SausageMeat"]=> string(11) "Sausagemeat" ["SausageMeatQty"]=> string(0) "" ["SausageMeatPrice"]=> float(0) ["PorkChop"]=> string(12) "4 Pork Chops" ["PorkChopQty"]=> string(0) "" ["PorkChopPrice"]=> float(0) ["Cranberry"]=> string(22) "Jar of Cranberry Sauce" ["CranberryQty"]=> string(0) "" ["CranberryPrice"]=> float(0) ["TurLeg"]=> string(21) "Turkey Leg and Thighs" ["TurLegQty"]=> string(0) "" ["TurLegPrice"]=> float(0) ["OrderTotal"]=> float(55.89) ["orders2017_recordAdded"]=> bool(true) }
I then replaced my original confirm.php file with a no frills confirm.php as follows and reinstated header location code:
<?php
var_dump($_SESSION);
?>
When placing the order again, on successful completion, my new confirm.php page displays and just says NULL. Therefore, the session variables are getting cleared for some reason.
Any help please ?????
Thanks in advance

S
sthefaine 9/27/2017

Andrew,
Add this to your php require_once("../include/dbcommon.php");
So you have :
<?php
require_once("../include/dbcommon.php");

var_dump($_SESSION);
?>
Steve

A
Andrew S author 9/27/2017

Steve,
Everything now working as expected following your advice.
Thank you so much for a very swift response to my request for help.
Andrew