Session variable not passing between pages

Hi, I've got a form that calculates checkbox values and puts them in a total field called txtTotal. When the user clicks send, I need to pass the total to a payment page.  The form page has PHP
session_start();
$_SESSION['sessTotal'] = $_POST['txtTotal'];
and the payment page has
session_start(); at the top of the page and <?php echo $_SESSION['sessTotal']; ?> where I want the total to display. The total does not carry over to the payment page and I can't work out why.
Here is all the PHP from the form page as I'm pretty new to PHP and not sure if there's a conflict (should session_start appear more than once?)  Thanks guys
<?php require_once('Connections/df.php'); ?>
<?php
//initialize the session
if (!isset($_SESSION)) {
session_start();
$_SESSION['sessTotal'] = $_POST['txtTotal'];
// ** Logout the current user. **
$logoutAction = $_SERVER['PHP_SELF']."?doLogout=true";
if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){
  $logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']);
if ((isset($_GET['doLogout'])) &&($_GET['doLogout']=="true")){
  //to fully log out a visitor we need to clear the session varialbles
  $_SESSION['MM_Username'] = NULL;
  $_SESSION['MM_UserGroup'] = NULL;
  $_SESSION['PrevUrl'] = NULL;
  unset($_SESSION['MM_Username']);
  unset($_SESSION['MM_UserGroup']);
  unset($_SESSION['PrevUrl']);
  $logoutGoTo = "index.php";
  if ($logoutGoTo) {
    header("Location: $logoutGoTo");
    exit;
?>
<?php
if (!isset($_SESSION)) {
  session_start();
$MM_authorizedUsers = "";
$MM_donotCheckaccess = "true";
// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
  // For security, start by assuming the visitor is NOT authorized.
  $isValid = False;
  // When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
  // Therefore, we know that a user is NOT logged in if that Session variable is blank.
  if (!empty($UserName)) {
    // Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
    // Parse the strings into arrays.
    $arrUsers = Explode(",", $strUsers);
    $arrGroups = Explode(",", $strGroups);
    if (in_array($UserName, $arrUsers)) {
      $isValid = true;
    // Or, you may restrict access to only certain users based on their username.
    if (in_array($UserGroup, $arrGroups)) {
      $isValid = true;
    if (($strUsers == "") && true) {
      $isValid = true;
  return $isValid;
$MM_restrictGoTo = "index.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {  
  $MM_qsChar = "?";
  $MM_referrer = $_SERVER['PHP_SELF'];
  if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
  if (isset($_SERVER['QUERY_STRING']) && strlen($_SERVER['QUERY_STRING']) > 0)
  $MM_referrer .= "?" . $_SERVER['QUERY_STRING'];
  $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
  header("Location: ". $MM_restrictGoTo);
  exit;
?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;   
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  return $theValue;
$colname_userDets = "-1";
if (isset($_SESSION['MM_Username'])) {
  $colname_userDets = $_SESSION['MM_Username'];
mysql_select_db($database_df, $df);
$query_userDets = sprintf("SELECT usersId, userName, password, name FROM users WHERE userName = %s", GetSQLValueString($colname_userDets, "text"));
$userDets = mysql_query($query_userDets, $df) or die(mysql_error());
$row_userDets = mysql_fetch_assoc($userDets);
$totalRows_userDets = mysql_num_rows($userDets);
?>

OK I got it.  I needed 
session_start();
$_SESSION['sessTotal'] = $_POST['txtTotal'];
on the payments page as well, not just session_start();

Similar Messages

  • Session Variables Randomly  Lost between Pages

    My web page uses a session to keep track of who logged in.
    What I noticed is that the session variables stored appears and
    disappears randomly on different pages. The wierd thing is that my
    code is very simple.
    For the life of me I can not figure this out....

    I go through a hosting company and do not expect them to do
    any load balancing.
    What are sticky sessions?
    The cflocation tag also has the addtoken="yes" to it now and
    symptoms persist.
    I tested the case with
    sessiontimeout=#CreateTimeSpan(0,2,0,0)# instead of the
    sessiontimeout=#CreateTimeSpan(0,0,120,0)# and symptoms still
    persist.
    Any other suggestions? I think I ran into a wall
    here....

  • Unable to fetch session variables in my application page code behind

    hi,
    my env:  1  WFE  server which hosts the  central admin and my web appln,  1 sql server box  
    i am having a custom web part[ listviewbyquery web part]  which populates the site collection/ sub site's document library contents . also it reads some query string values and pushes these  values into  session variables.
    and i am having another application page in this application which reads this session variables and  perform some operation in a custom sql db. But i am unable to read these session variables on page load of this  application page.
    am unable to debug also. so, would like to know is there any way i can see, what values  are getting passed to this page and verify the session variables are accessed correctly.
    or
    is this  by design, that its not possible to read session variables in the application page ?
    if i am not having a visual studio env. to debug, how to test these  session variable  existence / to find the root cause of this issue.
    note: already configured session state in IIS , http  modules section. am using Page.Session["myvariable1"].tostring() to fetch the  session variables.
    help is appreciated!

    i have found out myself. i have put  page.response.write(mysessionvariables) in the code and deployed and tested in my env. and i was able to find out the reason and i have fixed it with proper validation check.

  • Code to set and destroy session variables in Java Server Pages(JSP)

    code to set and destroy session variables in Java Server Pages(JSP)
    we have use following statement to set session variable
    session.setAttribute("userClient",id);
    we have use following statement to destroy session variable
    session.setAttribute("userClient","");
    and
    the session.invalidate() is not working
    Plz. solve this probem

    code to set and destroy session variables in Java
    Server Pages(JSP)
    we have use following statement to set session
    variable
    session.setAttribute("userClient",id);
    we have use following statement to destroy session
    variable
    session.setAttribute("userClient","");Perhaps if you tried using
    session.setAttribute("userClient", null);
    or
    session.removeAttribute("userClient");
    and
    the session.invalidate() is not workingNot working how?
    >
    Plz. solve this probem

  • Session variable being lost between parent and include file

    I am running into the following scenario: Page 1 includes page 2, on both pages a session variable is returned to the screen. On occasions, page 2 throws an error on the session variable even though it was successfully called on page 1.
    It only happens occassionally, and is very difficult to recreate in order to debug it in realtime. Has anyone run into something like this before? Thanks!

    semi star gazer wrote:
    I am running into the following scenario: Page 1 includes page 2, on both pages a session variable is returned to the screen. On occasions, page 2 throws an error on the session variable even though it was successfully called on page 1.
    It only happens occassionally, and is very difficult to recreate in order to debug it in realtime. Has anyone run into something like this before? Thanks!
    I suspect it has less to do with page-inclusion, more to do with the code on page 2. Suppose, instead of using cfinclude, you had copied the code from page 2 into page 1, and made 1 page of it. Then the error would still have occurred. That's at least my theory.
    Have a look at how the code in page 2 handles the session. There is bound to be something not quite right about it. What kind of error do you get anyway?
    Runtime debugging can be as simple as this:
    <cftry>
    <cfinclude template="page2.cfm">
    <cfcatch type="any">
    <cfdump var="#cfcatch#"><cfabort>
    </cfcatch>
    <cftry>

  • Session Variables Not Sticking

    We are having issue with Session variables sticking from page to page in our Admin area of our website. You can login, but as soon as you click on another link (or anything) they drop.  
    It's not a code issue because we have the same code on 2 other networks and it works fine. We also have the same code on our backup website on the same network and it works fine.  The backup is on a different server in a different location. So that's 3 networks the code is running fine on. It even worked on this network on the main website up until about 9 months ago. I've verified/reverified the code mutiple times. Something must have happened with security patches, some IIS setting, or other server related issue.  We are running 2003 Windows Server Edition SP2 and Coldfusion version 8,0,1,195765. 
    The browsers used are IE7 and IE8. I don't think it's a browser issue because I can open another tab in the same browser and login and stay logged in on the website on another network.  We have already gone into browser advanced settings to make sure session variables are allowed. We've also had a couple of other admins look at it from various locations throughout the Country and they also cannot stay logged in on our main site. They can all stay logged in on the backup site. 
    Frustrating beyond belief. I'm betting it's a Microsoft issue.  Anybody out there have a similar issue or know what it might be?

    I've experienced a similar problem with CF8 using IE8. I've narrowed it down to being cookie related which causes CF to loose the existing session and create a new session. For me, I can consistently duplicate the issue by having multiple tabs open to various sites and then accessing my site to login -- login is successful but the first page request is treated as unauthorized because the session is empty. If I shutdown and restart the browser and bring up only my site, everything works fine. And once I'm logged in, I have never lost a session by opening other tabs. And this has never failed using Firefox or Safari. What is very strange is that I have multiple sites using CF8 and CF9 and only one exibits this behaviour.

  • Session variable not storing in custom trigger

    I have a custom trigger in which I want to store a session variable , so i can use the value in the insert transaction which happens after. But for some reason the session variable is not stored, resulting in the data not being stored.
    any clues would help.
    rudi
    here are the relevant code:
    //start Trigger_Custom_Subject_Mentor trigger
    function Trigger_Custom_Subject_Mentor(&$tNG) {
    //Check subject exists
    @session_start();
    $_SESSION['sb_id'] = $subject_id;
    //end Trigger_Custom_Subject_Mentor trigger
    // Make an insert transaction instance
    $ins_share = new tNG_insert($conn_smart);
    $tNGs->addTransaction($ins_share);
    // Register triggers
    $ins_share->registerTrigger("STARTER", "Trigger_Default_Starter", 1, "POST", "KT_Insert1");
    $ins_share->registerTrigger("END", "Trigger_Redirect", 90);
    // Add columns
    $ins_share->setTable("`share`");
    $ins_share->addColumn("share_item", "NUMERIC_TYPE", "POST", "share_item");
    $ins_share->addColumn("share_subject", "NUMERIC_TYPE", "SESSION", "sb_id");
    $ins_share->setPrimaryKey("share_id", "NUMERIC_TYPE");
    // Register triggers
    $ins_share->registerTrigger("STARTER", "Trigger_Default_Starter", 1, "POST", "KT_Insert1");
    $ins_share->registerTrigger("BEFORE", "Trigger_Custom_Subject_Mentor", 50);
    $ins_share->registerTrigger("END", "Trigger_Default_Redirect", 99, "share.php?item_id={share_item}");

    hi User,
    1) Pull a dummy column in Fx use the Session variable --->(Variable -->session )
    2) Next, goto narrative view in Narrative view section use @1
    3) If u want you can hide the column that we created in criteria section

  • Row level security with session variables, not a best practice?

    Hello,
    We are about to implement row level security in our BI project using OBIEE, and the solution we found most convenient for our requirement was to use session variables with initalization blocks.
    The problem is that this method is listed as a "non best practice" in the Oracle documentation.
    Alternative Security Administration Options - 11g Release 1 (11.1.1)
    (This appendix describes alternative security administration options included for backward compatibility with upgraded systems and are not considered a best practice.)
    Managing Session Variables
    System session variables obtain their values from initialization blocks and are used to authenticate Oracle Business Intelligence users against external sources such as LDAP servers or database tables. Every active BI Server session generates session variables and initializes them. Each session variable instance can be initialized to a different value. For more information about how session variable and initialization blocks are used by Oracle Business Intelligence, see "Using Variables in the Oracle BI Repository" in Oracle Fusion Middleware Metadata Repository Builder's Guide for Oracle Business Intelligence Enterprise Edition.
    How confusing... what is the best practice then?
    Thank you for your help.
    Joao Moreira

    authenticating / authorizing part is take care by weblogic and then USER variable initialized and you may use it for any initblocks for security.
    Init block for authenticating / authorizing and session variables are different, i guess you are mixing both.

  • Page zoom not holding between pages in FF4

    Back in good old FF 3 page zoom would hold between pages or on refresh, I am finding with FF4 every time I reload a page or click a link to a different part of the same website I need to re-size the page, as I use FF for its zoom function this is starting to get a bit frustrating, anyone know how to fix it?
    Much appreciated

    Make sure that you not run Firefox in (permanent) [[Private Browsing]] mode.
    * You enter Private Browsing mode if you select: Tools > Options > Privacy > History: Firefox will: "Never Remember History"
    * To see all History and Cookie settings, choose: Tools > Options > Privacy, choose the setting <b>Firefox will: Use custom settings for history</b>
    * Uncheck: [ ] "Permanent Private Browsing mode"

  • Hierarchy variable not passed over to universe

    Hierarchy variable is not passed to the universe from the query, note 1007048 is not applicable to our system.
    Any ideas on what other config to check and change ?

    Hi,
    - does the query work without any issues in transaction RSRT ?
    - do you see the variable as filter in the Universe ?
    Ingo

  • Session variables not clearing

    Hello,
    I'm working on a series of web pages that will be compatible with an Apple iPad.  Here's what I'm working on:
    When a user hits my index.cfm page, CF checks a table for records.  If there are no records, cflocation sends the user to a menu page and only creates one session variable, "Device."
    If there is one record in the table, cf creates the variables "Device" and "Loc" and sets "Loc" to whatever the value in a certain table field is.  Then cflocation sends the user to the same menu page as above, but because "Loc" is defined, the value of "Loc" is output in various places on the page.
    If more than one record is found, the user must select their choice from the index.cfm page.  From there, cflocation takes their choice, adds it to a url variable, and takes the user to a page that defines "Loc" based on the url variable.  Then cflocation sends the user to the same menu page, but because "Loc" is defined, the value of "Loc" is output in various places on the page.
    Everything works well.
    Here's the problem: I can't get "Loc" to clear on demand.  At the top of my index page, I have <cfscript>StructDelete(Session, "Loc");</cfscript> to clear anything that might be in the application.  On my desktop (a PC browsing with Chrome), this works.  For testing, I'll put one record in the table and the process that I described above works. If I delete that record and run index.cfm again, "Loc" is cleared and the menu page appears as it should.
    However, if I add a record, run index.cfm on my iPad to create "Loc," then go back and delete the record from the table and run index.cfm again, the variable is still defined.  This happens on the iPad only.
    I'm stuck. Can anyone offer any insight?
    Thank you!

    You might try adding cache directives to your HTTP headers using CFHEADER.  Something like:
    <cfheader name="Cache-Control" value="no-cache">
    <cfheader name="Expires" value="0"> 
    CFHEADER
    http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7a ea.html 
    Caching in HTTP from W3C
    http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html

  • Data not passing between two Views in FPM-GAF

    Hello All
    I have first screen (view) configured with Initial screen and second view with main step using FPM GAF. But data is not passing from first screen to second screen. All  views/Windows contains in the one component.
    Example: In First Screen contains Employee Data in table , selecting the row clicks on button it is navigating to other screen (Mainstep) BUT selected data is not passing.
    BR
    -CW

    Hello Williams,
    CarlinWilliams wrote:
    > From FPM Intial Screen of data is not passing to the second screen. Where as in other Steps data is passing.
    I'm bit surprised to hear that this is working in other screens. As per the FPM concepts (my understanding), for the parent component that is used in child component, it will create a new instance and it wont re-use the instance of the Parent Component that is already embedded in the Initial Screen.
    In your case, you have embeded the parent component in Initial Screen. So FPM framework will create a new instance at runtime. while navigating to the Main Step, since child component is using parent component, the FPM wont re-use the instance of parent component. Rather it will create a new instancs of parent component. Since new instance is created, the data entered in the previous step/screen wont be available. this behavior is same for all the steps.
    anyway comming to your question and solution for the same.
    1. In the child component, create another window (say PARENT_WINDOW) and embed the view that was exposed by the parent component (basically interface view of the parent component)
    2. in the GAF component configuration, for the initial screen, embed the child component and view as PARENT_WINDOW
    3. for the main step, embed the child component and view as acutal view of the child component.
    Here same component is used in both the places. Now the FPM will try to reuse the instance of the child component. As a result, the data entered in the Initial screen will be available in the Main Step as well.
    Other approach would be to use the singleton class and share the data between these two components.
    Hope this solves your problem.
    BR, Saravanan

  • Parameter Passing between pages- process not picking up on changes

    Hello, new user, this is a different question than before.
    I have a drop-down list box on Page 1, upon which the user can choose a study number. The List Box is named "P1_STUDY_NBR".
    Then I have a list, one entry of which goes to my master-detail form, which is Page 6. I would like it to go to the study number that the user choose on Page 1.
    In my target on the create/edit list entry, I put in "Page in this Application", "Page 6", then in Set these items, I put in
    P6_STUDY_NBR
    My question is what to use in With these values, where I want the contents of the P1_STUDY_NBR. I tried:
    &P1_STUDY_NBR.
    Now I've got it passing to the master detail form, but it passes whatever was the first value! i.e, if I set the default of the drop-down list box to 336-00, then it opens the form with 336-00, and if I set the default on the drop-down list to 005-07, then it opens to 005-07.
    However, if I change the value in the drop-down list box to something else, then press the link in the list to go to the page, then it doesn't pass the new value like I want (it passes whatever was the default value).
    Is there something that accepts the new value into the variable upon the change in that drop-down list box that I need to add to my processes, or why won't it use the new value as the parameter?
    -Mary

    I'd recommend (re)reading "Understanding Page Processing and Page Rendering" in the Users Guide and then redesigning your page. The problem is that you change the study number list selection in the browser but the change never gets processed because a navigation list link doesn't submit the form, it only navigates away from it.
    You could try making the study number list type "Select List with Redirect" which processes the change so that the new selection value gets set to the session state and then returns to the same page.

  • Session Variable not producing results in answers

    Hi,
    I have a Session initialization block and I have the variable target assigned to a variable region_info. My SQL is this "select Region from SH.USER_INFO where UPPER(USER_ID)=UPPER(':USER'). It gives me the correct results in RPD.
    In answers and in the filter I say Region is equal to/is in NQ_SESSION.Region_info until this point it works great.
    How would I modify it to accept multiple rows. I tried the Row-wise initialization and I am getting an error, saying NQ_SESSION.Region_info has no value definition. How can I make it work if the initialization block returns multiple rows and in the answers if I have to pass them both in my filter?
    Please help. Thank you.

    ssk,
    No,it will not work u can't use that in answers fx
    http://download.oracle.com/docs/cd/E12096_01/books/admintool/admintool_Variables5.html
    http://108obiee.blogspot.com/2009/10/using-multiple-values-row-wise-session.html
    Thanks,
    Saichand.v

  • GetURL(varLink01, "_self"); variable not passing???

    i'm passing varLink01 from PHP to a flash file no problem (it
    loads into a dynamic text field fine).
    but when i try and load this variable to the getURL command
    the link is not working, the flash takes me to a "page not found."
    here is my code:
    DECLARE VAR
    var passed:String = varLink01;
    (different layer, same frame)
    ACTION SCRIPT
    on (release) {
    getURL(varLink01, "_self");
    i've put hours into this.... any help???
    Thanks, Joe

    i'm getting this in my Output Panel:
    "One or more breakpoints have been removed because they are
    not on valid lines of code." this is weird since the SWF file runs
    perfectly other than this issue.
    i updated my code to be sure my vars are declared and
    defined--
    var varImage01:String = "
    http://www.liquidmilitia.com/gallery2/d/2966-1/01.jpg";
    var varLink01:String = "
    http://www.yahoo.com";
    var passed:String = varImage01;
    i01load.contentPath = varImage01;
    var passed:String = varLink01;
    BUT-
    i'm using Actionscript 2.0. if i can RUN and DISPLAY the
    value of varLink01 in a dynamic text box like
    i am in the SWF file -- doesn't this confirm that the
    variable is succifiently declared and defined?
    I'm really sorry if i'm missing something here...

Maybe you are looking for

  • Installation of Oracle 8i(8.1.7) on RedHat ELAS 3.0

    Gentlemen, Did anyone successfully complete the installation of Oracle 8.1.7 on RHELAS 3.0? With the information and note on the web page www3.sympatico.ca/arothmel/oracle/817.html, I am able to proceed with the installation of most of the components

  • Email not connecting

    I have been away travelling for a few days and three days ago, my iPad (iOS 8.2) failed to connect to my two email providers. Now I am home, and although the device indicates 'connected' (and I can get my emails on my home PC using the same ISP), I c

  • Combobx prolem

    Hello expert I make define New functionality in combo box like in sap but sir i get problem that when i click on define new it open one table when i add code and name in table and update it and close the updated entry not display in combo box but whe

  • Setting for Nokia 202

    how to set GPRS for Nokia 202 daul sim and it's internet connection.

  • Which Iskin Belt clip for SwitchEasy CapsuleRebel

    Hello, I just got an Iphone 3g this past weekend and Im looking at cases. I think I am going to go with the SwitchEasy Capsule Rebel. I read that one of the Iskin Clips fits it nicely. Could someone tell me which one? The one for the Revo or the one