mysql - PHP session variables blank after page refresh -



mysql - PHP session variables blank after page refresh -

i wrote post before , got responses corrected error had, thought fixed problem. unfortunately didn't, , old post messy plenty i'm going repost problem, added perspective have gained struggling while.

code (simplified):

<?php session_start(); if (!$_session["companyid"]) { header("location: http://www.somepage.com"); } mysql_connect("localhost", "name", "password") or die(mysql_error()); mysql_select_db("database") or die(mysql_error()); $companyid = $_session["companyid"]; $_session["youtubeurl"] = mysql_real_escape_string($_post["youtubeurl"]); $_session["logourl"] = mysql_real_escape_string($_post["logourl"]); $_session["plan1head"] = mysql_real_escape_string($_post["plan1head"]); $_session["plan1description"] = mysql_real_escape_string($_post["plan1description"]); $_session["plan1headline1"] = mysql_real_escape_string($_post["plan1headline1"]); $_session["plan1price1"] = mysql_real_escape_string($_post["plan1price1"]); $_session["plan1headline2"] = mysql_real_escape_string($_post["plan1headline2"]); $_session["plan1price2"] = mysql_real_escape_string($_post["plan1price2"]); $_session["plan1price1type"] = mysql_real_escape_string($_post["plan1price1type"]); $_session["plan1price2type"] = mysql_real_escape_string($_post["plan1price2type"]); if(isset($_post["submitpreview"])) { $companyid = $_session["companyid"]; $youtubeurl = $_session["youtubeurl"]; $logourl = $_session["logourl"]; $plan1head = $_session["plan1head"]; $plan1description = $_session["plan1description"]; $plan1headline1 = $_session["plan1headline1"]; $plan1price1 = $_session["plan1price1"]; $plan1headline2 = $_session["plan1headline2"]; $plan1price2 = $_session["plan1price2"]; $plan1price1type = $_session["plan1price1type"]; $plan1price2type = $_session["plan1price2type"]; } ?>

now, there 3 pages/instances involved this:

page forms pass variables preview page preview page submitted preview page (meaning page refreshed)

a person has own page filled various text fields , drop-down menus (page 1). can update page, , when fill out form , submit it, variables passed onto preview page. if preview page, confirm (submitting form executes "submitpreview").

here problem: session variables beingness filled form (everything company id, stored in session when first log in) dumped session variable. have echoed out session variables @ bottom of preview page (just confirm not empty @ point in time), , contents echoed out appropriately when preview page. however, when user confirms changes , submitpreview set, session variables empty. is, session variables filled form variables empty. session variables echoed out fine before page refreshed gone except companyid variable. since companyid session variable still fine, know (1) sessions on server must working right , (2) problem lies code either dumping form variables sessions or retrieving variables. theories why may occurring?

this has me pretty frustrated. appreciate patience me on issue , appreciate help given.

figured out, thought share.

in instances such when have session variables equal post variables on page refreshes, have careful. when preview page refresh, post variables (since no longer existed) became empty, overwrote info session variables had saved , in turn made session variables empty well. had adjust code accordingly prepare problem.

php mysql

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -