Jump to content

chersull_99

New Members
  • Posts

    7
  • Joined

  • Last visited

    Never

Everything posted by chersull_99

  1. I'm restarting this under a new subject b/c I learned some things after I initially posted and the subject heading is no longer accurate. What would cause this behavior - when I populate session vars from a MYSQL query, they stick, if I populate them from an MSSQL query, they drop. It doesn't matter if I get to the next page using a header redirect or a form submit. I have two session vars I'm loading from a MYSQL query and they remain, the two loaded from MSSQL disappear. I have confirmed that all four session vars are loading ok initially and I can echo them out to the page, but when the application moves to next page via redirect or form submit, the two vars loaded from MSSQL are empty. Any ideas?
  2. I am restarting this thread under a new subject line b/c issues I discovered related to this are no longer accurately reflected in the "Losing SOME session variables..." subject. Please look for the new question - "Why do session vars loaded from a MSSQL query drop, while those loaded from a MYSQL query stick?" Thanks!
  3. Sorry, that didn't work either. Note the change in the subject line. I discovered that if I populate my disappearing session vars from MYSQL rather than MSSQL, they stick after the redirect. Curiouser and curiouser. The SSN and Cost Center session vars that are coming from my MSSQL database are still blank on the http://webapps/injury/empForm.php page after applying the change you suggested. The entire application begins on http://webapps/injury/default.php, where the Last Name and Badge ID# are entered. The user is also asked if he needs to start a new report or check the status of an existing report. This is there the rdoAction is coming from. The form on default.php is submitted to http://webapps/injury/mainRedirect.php, which is where the code in question appears. This page takes the Last Name and Badge ID values posted there and puts them into session vars. It then queries the MS SQL database and puts the SSN and Cost Center into two other session vars, which are getting lost on the redirect. Just for grins I added a random query to a MYSQL database and stored one of those values into a session var and THIS session var sticks when I redirect to empForm.php. So it seems clear now that the problem is isolated to session vars populated using values from an MS SQL query. Any ideas, PHP-ers???
  4. You can do this - and the hidden field's value will change based on whatever value you set for @formVariable. Is that what you mean? ------------------------ <?php $formVariable = "This Value"; ?> <form name="frmSample" action="frmSubmit.php" method="post"> <input type="hidden" name="hdnVariable" value="<?php print $formVariable; ?>"> <input type="submit"> </form>
  5. If I echo the SSN and Cost Center session variables before redirecting, the values are there. If I echo them on the page I'm redirecting to, they are not. The Last Name and Badge ID session variables are populated before and after redirection. It only seems that the SSN and Cost Center session variables are losing their value upon redirection.
  6. Well here is ONE way to get the data to my empForm.php screen, but it doesn't solve my original question - and it seems really hokey. Basically if the action the screen is supposed to redirect to the empForm.php screen, I have it build a form and submit it, placing my SSN and Cost Center values as hidden form fields. ewwww... ------------------------------------------------- if ($_POST['rdoAction'] == 0) {?> <form name="frmGoToEmpForm" ID="frmGoToEmpForm" method="post" action="empForm.php"> <input type="hidden" id="hdnSSN" name="hdnSSN" value="<?php print $rs_emp_info->fields("emp_ssn");?>" /> <input type="hidden" id="hdnCostCenter" name="hdnCostCenter" value="<?php print $rs_emp_info->fields("emp_costcenter");?>" /> </form> <script language="javascript">frmGoToEmpForm.submit();</script> <?php }?>
  7. I have four session variables, two I am valueing using $_POST elements from a previous page's form, the other two I am valueing using items retrieved from a database. Here is the code - ---------------------------------------------------- <?php session_start(); $_SESSION['UserLastName'] = strtolower(trim($_POST['txtLastName'])); $_SESSION['BadgeID'] = trim($_POST['txtBadgeID']); //get list for supervisor drop down $q1 = sprintf("select * from emps where emp_last = '".$_SESSION['UserLastName']."' and emp_badge = '".$_SESSION['BadgeID']."'"); $rs_emp_info = hitMSSQL($q1,"intra_sql","employees","xxxx","xxxx",1); $_SESSION['SSN'] = $rs_emp_info->fields("emp_ssn"); $_SESSION['CostCenter'] = $rs_emp_info->fields("emp_costcenter"); if ($_POST['rdoAction'] == 0) { header("Location: http://webapps/injury/empForm.php"); } ?> ---------------------------- When I get to the next page, empForm.php, the Last name and badge ID session vars are populated but the SSN and Cost Center session vars are not. I have tried several things including putting an exit(); after my header statement and first putting the database items into plain old $vars and then trying to populate the session vars with the value of the regular $vars, but nothing seems to work. I have a session_start() at the top of all of my scripts. Any idea why I am losing these values? (and why this box that I am typing into on this site is bouncing around so badly that I can't see what I am typing here???)
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.