Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

$_SESSION shot in the dark 2

Status
Not open for further replies.

jordanking

Programmer
Sep 8, 2005
351
Hello,

this one might be obscure.

I have a user form that accepts user input, evaluates it for errors, and if no errors are found, inserts a record into a mysql database. Everything works perfectly on my testing server (apache) but there is a minor glitch on my remote server.

The problem is:
I use session variables to display a summary of the last successfully inserted record. The php script is sent to itself ($_SERVER['PHP_SELF']) and an array ($error) is created. If there are any errors an array element is added and the insert record script is ignored.

The insert record code is as follows

Code:
// wraps entire insert record behavior in a conditional stament based on whether the $error array is empty
if (!$error) {
	if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "residential")) {
	  $insertSQL = sprintf("INSERT INTO residential (user_id, dt_enter, dt_service, cust_id, service_id, address, city, vendor, `zone`, listers, signs, co_listing, co_value, status, instructions, hanger1, hanger2, hanger3, topper, amount, price) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
						   GetSQLValueString($_POST['user_id'], "int"),
						   GetSQLValueString($_POST['dt_enter'], "date"),
						   GetSQLValueString($_POST['dt_service'], "date"),
						   GetSQLValueString($_POST['realtor_id'], "int"),
						   GetSQLValueString($_POST['service_id'], "int"),
						   GetSQLValueString($_POST['address'], "text"),
						   GetSQLValueString($_POST['city'], "int"),
						   GetSQLValueString($_POST['vendor'], "text"),
						   GetSQLValueString($_POST['zone'], "int"),
						   GetSQLValueString($_POST['listers'], "int"),
						   GetSQLValueString($_POST['signs'], "int"),
						   GetSQLValueString($_POST['co_listing'], "int"),
						   GetSQLValueString($_POST['co_value'], "text"),
						   GetSQLValueString($_POST['status'], "int"),
						   GetSQLValueString($_POST['instructions'], "text"),
						   GetSQLValueString($_POST['hanger1'], "text"),
						   GetSQLValueString($_POST['hanger2'], "text"),
						   GetSQLValueString($_POST['hanger3'], "text"),
						   GetSQLValueString($_POST['topper'], "text"),
						   GetSQLValueString($_POST['amount'], "double"),
						   GetSQLValueString($_POST['price'], "double"));
	
	  mysql_select_db($database_regentAdmin, $regentAdmin);
	  $Result1 = mysql_query($insertSQL, $regentAdmin) or die(mysql_error());
	 
	 // assign a session tracking variable when record is inserted
	 $_SESSION['success'] = $Result1;
			
	  $insertGoTo = "comp_submissions.php";
	  if (isset($_SERVER['QUERY_STRING'])) {
		$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
		$insertGoTo .= $_SERVER['QUERY_STRING'];
	  }
	  header(sprintf("Location: %s", $insertGoTo));
	}
	// if the record has been inserted, clear the POST array
	$_POST = array();
}

The page is based on other session variables so i know that the session is set and working. However the
"$_SESSION['success'] = 1;" is not "working"

later in the script i have a refrence to this value
Code:
		// uses the return value of the insert query function to display a success or error message.
		if(isset($_SESSION['success']) && $_SESSION['success'] == 1){
			echo "<p class='success'><strong>The following record was sucessfully submitted:</strong></p><p class='success'>REALTOR: ".$_SESSION['rltr_firstName']." ".$_SESSION['rltr_familyName']."<br />ADDRESS: ".$_SESSION['address']."</p>";
		}elseif(isset($_SESSION['success']) && $_SESSION['success'] != 1){
	 		echo "<p class='success'>Record submission failed.  Please try again.<br />If problem persits, contact the Regent Signs office.</p>";
		}
it is always unset let alone equal to 1(which is, to my understanding, the successful return of the mysql_query function).

Again, this all works perfectly on my testing apache server.

Is there some session varriable setting that might be different on my remote server that i need to adjust for.

 
my bad. change $_COOKIES to $_COOKIE and repost please!
 
okay, no prob, I made an error also, I had output before the doct type declaration that threw out the result. The following is correct.

here it is before:

Code:
Sessions Array
(
    [MM_Username] => rxPolaris
    [MM_UserGroup] => y
    [username] => rxPolaris
    [user_id] => 8
    [cust_id] => 1616
    [first_name] => Realty Executives
    [family_name] => Polaris Office
    [comp_priv] => y
    [comp_id] => 105
)
CookiesArray
(
    [PHPSESSID] => c82375686fbb5a03561d3c1edd44d6be
)

and after

Code:
Sessions Array
(
    [MM_Username] => rxPolaris
    [MM_UserGroup] => y
    [username] => rxPolaris
    [user_id] => 8
    [cust_id] => 1616
    [first_name] => Realty Executives
    [family_name] => Polaris Office
    [comp_priv] => y
    [comp_id] => 105
)
CookiesArray
(
    [PHPSESSID] => c82375686fbb5a03561d3c1edd44d6be
)
 
ok. that's good. it means the session is being properly saved and that the session cookies is being properly transferred.

but you say that the $_SESSION['success'] remains unavailable in your receiving script. Is this the case or are you now exhibiting other errors (i note that above you say you are actually looking to transfer other session data).

i would add an error check to the mysql_select_db call if i were you.
 
here is the sessio nvaraibles that I am trying to pass conditional on if the insert record was succesfull

Code:
	  mysql_select_db($database_regentAdmin, $regentAdmin);
	  $Result1 = mysql_query($insertSQL, $regentAdmin);
	 
	// assign a session tracking variable when record is inserted
	if ($Result1 === TRUE){
        $_SESSION['success'] = 1;
		$_SESSION['rltr_firstName'] = $row_getCustInfo['txtFirstName'];
	 	$_SESSION['rltr_familyName'] = $row_getCustInfo['txtLastName'];
	 	$_SESSION['address'] = $_POST['address'];
    }

all other session varaibles are maintained and passed properly to the recieving script, except these ones.

Is this what you mean by error checking the mysql_selet_db call?
 
can you try this replacement code snip to see what is returned:

Code:
mysql_select_db($database_regentAdmin, $regentAdmin)
	or die("can't connect to database");

$Result1 = mysql_query($insertSQL, $regentAdmin);

// assign a session tracking variable when record is inserted
if ($Result1 === TRUE){
	echo "test has been passed";
	$_SESSION['success'] = 1;
	$_SESSION['rltr_firstName'] = $row_getCustInfo['txtFirstName'];
	$_SESSION['rltr_familyName'] = $row_getCustInfo['txtLastName'];
	$_SESSION['address'] = $_POST['address'];
	echo 'click <a href="comp_submissions.php"> here </a>to go to the next page';
}
else {
	echo "problem writing to database ". mysql_error() ; }
 
Hello again,

here is the result:
Code:
test has been passedclick here to go to the next page
Warning: Cannot modify header information - headers already sent by (output started at D:\Websites\[URL unfurl="true"]www.regentsigns.com\erequest\comp_submissions.php:301)[/URL] in D:\Websites\[URL unfurl="true"]www.regentsigns.com\erequest\comp_submissions.php[/URL] on line 316
 
well ... that means that the session is being saved ok.

i did not include any code in the replacement sample which would send header information so i am assuming that you added code that i did not post?
 
the code you gave me replaces code that is before the:

Code:
<!DOCTYPE html PUBLIC ".......

As I have the majority of my php validation etc before the document delcaration and opening html tag.
 
here is all of it:)

Code:
<?php require_once('../Connections/regentSelect.php'); ?>
<?php require_once('../Connections/regentAdmin.php'); ?>
<?php
if (!isset($_SESSION)) {
  session_start();
}

//redirect user if thier comp privilages are not yes
if (isset($_SESSION['comp_priv']) && $_SESSION['comp_priv']=='n'){
  $insertGoTo = "indv_submissions.php";
  $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
  header(sprintf("Location: %s", $insertGoTo));
}	

// reset the error tracking array
$error = array();

// recordset retrieves customer information and assigns it to variables
$var1_getCustInfo = "0";
if (isset($_POST['realtor_id'])) {
  $var1_getCustInfo = (get_magic_quotes_gpc()) ? $_POST['realtor_id'] : addslashes($_POST['realtor_id']);
}
mysql_select_db($database_regentAdmin, $regentAdmin);
$query_getCustInfo = sprintf("SELECT customer.idsCustomerID, customer.lngzCompanyID, customer.txtFirstName, customer.txtLastName, customer.lngzAccountStatus, customer.lngzPostID, customer.numHangers, customer.lngzPayment, customer.curSpecial, post.PostId, post.curAddCost FROM customer LEFT JOIN post ON customer.lngzPostID = post.PostID WHERE customer.idsCustomerID = '%s'", $var1_getCustInfo);
$getCustInfo = mysql_query($query_getCustInfo, $regentAdmin) or die(mysql_error());
$row_getCustInfo = mysql_fetch_assoc($getCustInfo);
$totalRows_getCustInfo = mysql_num_rows($getCustInfo);
$rltr_hangers = $row_getCustInfo['numHangers'];
$rltr_payment = $row_getCustInfo['lngzPayment'];
$rltr_special = $row_getCustInfo['curSpecial'];
$rltr_post = $row_getCustInfo['curAddCost'];
$rltr_status = $row_getCustInfo['lngzAccountStatus'];

// Recordset populates the customer drop down menu
$var1_getRealtors = "0";
if (isset($_SESSION['comp_id'])) {
  $var1_getRealtors = (get_magic_quotes_gpc()) ? $_SESSION['comp_id'] : addslashes($_SESSION['comp_id']);
}
mysql_select_db($database_regentSelect, $regentSelect);
$query_getRealtors = sprintf("SELECT customer.idsCustomerID,CONCAT( customer.txtLastName, ', ', customer.txtFirstName) AS Realtor FROM customer WHERE customer.lngzAccountStatus = 1 AND customer.blnErequest = 0 AND customer.lngzCompanyID = %s ORDER BY customer.txtLastName, customer.txtFirstName", $var1_getRealtors);
$getRealtors = mysql_query($query_getRealtors, $regentSelect) or die(mysql_error());
$row_getRealtors = mysql_fetch_assoc($getRealtors);
$totalRows_getRealtors = mysql_num_rows($getRealtors);

// validate form input
$MM_flag="MM_insert";
if (isset($_POST[$MM_flag])) {
	// assign user id value from session variable
	$_POST['user_id'] = intval($_SESSION['user_id']);
	// check to ensure realtor is selected
	if (empty($_POST['realtor_id'])) {
		$error['realtor'] = 'Please select a Realtor for the Record';
	}
	// check to ensure service is selected
	if (empty($_POST['service_id'])) {
		$error['service_blank'] = 'Please select a service for the Record';
	}
	// check to ensure zone is selected
	if (empty($_POST['zone'])) {
		$error['zone_blank'] = 'Please select a zone for the Record';
	}	

	//check for valid date format
  	$pattern = '((0[1-9]|[12][0-9]|3[01])[/](0[1-9]|1[012])[/](19|20)\d\d)';
	if (!preg_match($pattern, trim($_POST['dt_service']))) {
    	$error['date'] = 'Please enter a valid date. Format: dd/mm/yyyy';
    } else {
		$dt_exp = explode("/", $_POST['dt_service']);
		$d = $dt_exp[0];
		$m = $dt_exp[1];
		$y = $dt_exp[2];
		$_POST['dt_service'] = $y.'-'.$m.'-'.$d;
	} 
	// check to make sure there are no post dated ups or fixes
	$entry_date = trim($_POST['dt_service']);
	$tmrw_date = trim(date('Y-m-d', mktime(0, 0, 0, date("m"), date("d")+1, date("y"))));
	if (isset($_POST['service_id']) && $_POST['service_id']==1){
		if ($entry_date != $tmrw_date){
			$error['post_up'] = "Regent Signs does not accept post dated UP requests.  Please change the service date to tommorow.";
		}
	}elseif (isset($_POST['service_id']) && $_POST['service_id']==3){
		if ($entry_date != $tmrw_date){
			$error['post_up'] = "Regent Signs does not accept post dated FIX requests.  Please change the service date to tommorow.";
		}
	}elseif (isset($_POST['service_id']) && $_POST['service_id']==4){
		if ($entry_date != $tmrw_date){
			$error['post_up'] = "Regent Signs does not accept post dated CONDO UP requests.  Please change the service date to tommorow.";
		}	
	}
	// check for valid address format
  	$pattern = '((^([1-9]([0-9]*)[,][\s])(([1-9]([0-9]*))(([-]([1-9]([0-9]*))|([\s][a-z-A-Z\s]*)))))|((^([1-9]([0-9]*))(([-]([1-9]([0-9]*))|([\s][a-z-A-Z\s]*)))))([\s]([a-z-A-Z\s]*)$))';
	if (!preg_match($pattern, trim($_POST['address']))) {
		$error['address'] = 'Please enter a valid Address';
    } 
		
	//quadrant value evaluation
	if ($_POST['quadrant'] == 2){
		$_POST['address'] = $_POST['address']." SW";
	}
	
	// assigne the entry date value
	$_POST['dt_enter'] = date('Y-m-d');	
	
	// use the service field to assign the status value
	if ($_POST['service_id']==1){
		$_POST['status'] = true;
	}else{
		$_POST['status'] = false;
	}
	// use the service value and city value to calculate the Regent Service value equivilant
	$service_flg = false;
	if ($_POST['service_id']==1 && $service_flg == false){
		if ($_POST['city']<4){
			$_POST['service_id'] = 1;
			$service_flg = true;
		}elseif ($_POST['city']==7){
			$_POST['service_id'] = 3;
			$service_flg = true;
		}elseif ($_POST['city']>3 && $service_flg == false){
			$_POST['service_id'] = 2;
			$service_flg = true;
		}	
	}elseif ($_POST['service_id']==2 && $service_flg == false){
		if ($_POST['city']<4){
			$_POST['service_id'] = 8;
			$service_flg = true;
		}elseif ($_POST['city']==7){
			$_POST['service_id'] = 10;
			$service_flg = true;
		}elseif ($_POST['city']>3 && $service_flg == false){
			$_POST['service_id'] = 9;
			$service_flg = true;
		}
	}elseif ($_POST['service_id']==3 && $service_flg == false){
		if ($_POST['city']<4){
			$_POST['service_id'] = 15;
			$service_flg = true;
		}elseif ($_POST['city']==7){
			$_POST['service_id'] = 17;
			$service_flg = true;
		}elseif ($_POST['city']>3 && $service_flg == false){
			$_POST['service_id'] = 16;
			$service_flg = true;
		}
	}elseif ($_POST['service_id']==4 && $service_flg == false){
		$_POST['service_id'] = 43;
		$service_flg = true;
	}elseif ($_POST['service_id']==5 && $service_flg == false){
		$_POST['service_id'] = 44;
		$service_flg = true;
	}else{
		$error['service'] = 'Invalid Service Codes';
	}
	// recordset for obtaining the service amount
	if (isset($_POST['service_id'])) {
	  $var1_getService = (get_magic_quotes_gpc()) ? $_POST['service_id'] : addslashes($_POST['service_id']);
	}
	mysql_select_db($database_regentAdmin, $regentAdmin);
	$query_getService = sprintf("SELECT service.ServiceId, service.Amount FROM service WHERE service.ServiceId = %s", $var1_getService);
	$getService = mysql_query($query_getService, $regentAdmin) or die(mysql_error());
	$row_getService = mysql_fetch_assoc($getService);
	$totalRows_getService = mysql_num_rows($getService);
	// use the listers value to calculate the co-listing and co_value values
	if ($_POST['listers']>1){
		$_POST['co_listing'] = '1';
		$_POST['co_value'] = "0.5";	
	}else{
		$_POST['co_listing'] = '0';
		$_POST['co_value'] = "";
	}
	// use the customer info table, service, listers, and signs fields to calculate the amount and price values
	// This calculation must occure after the service id has been changed to the Regent Service ID
	if($rltr_status==1){
		if ($rltr_payment==1){
			if ($_POST['service_id'] == (1||2||3)){
				$_POST['amount'] = (($row_getService['Amount']+$rltr_post)/$_POST['listers'])+($rltr_hangers*0.5)+($rltr_special);
				$_POST['price'] = ($_POST['amount']*$_POST['signs']);
			}elseif ($_POST['service_id'] == (8||9||10)){
				$_POST['amount'] = ($row_getService['Amount']/$_POST['listers']);
				$_POST['price'] = ($_POST['amount']*$_POST['signs']);
			}elseif ($_POST['service_id'] == (15||16||17)){
				$_POST['amount'] = ($row_getService['Amount']/$_POST['listers']);
				$_POST['price'] = ($_POST['amount']*$_POST['signs']);
			}elseif ($_POST['service_id'] == (43||44)){
				$_POST['amount'] = ($row_getService['Amount']/$_POST['listers']);
				$_POST['price'] = ($_POST['amount']*$_POST['signs']);
			}else{
				$error['service_amount'] = "There is an error with the service conditions, please contact Regent Signs";
			}
		}elseif($rltr_payment==2){
			if ($_POST['service_id'] == (1||2||3)){
				$_POST['amount'] = ((($row_getService['Amount']+$rltr_post)*2)/$_POST['listers'])+($rltr_hangers*0.5)+($rltr_special);
				$_POST['price'] = ($_POST['amount']*$_POST['signs']);
			}elseif ($_POST['service_id'] == (8||9||10)){
				$_POST['amount'] = 0;
				$_POST['price'] = ($_POST['amount']*$_POST['signs']);
			}elseif ($_POST['service_id'] == (15||16||17)){
				$_POST['amount'] = ($row_getService['Amount']/$_POST['listers']);
				$_POST['price'] = ($_POST['amount']*$_POST['signs']);			
			}elseif ($_POST['service_id'] == (43||44)){
				$_POST['amount'] = ($row_getService['Amount']/$_POST['listers']);
				$_POST['price'] = ($_POST['amount']*$_POST['signs']);
			}else{
				$error['service_amount'] = "There is an error with the service conditions, please contact Regent Signs";
			}
		}else{
			$error['service_value'] = "There is an error with the service calculation, please contact Regent Signs";
		}
	}else{
		$error['status'] = "The selected customer's account has been flagged, please contact Regent Signs";
	}
	// determine whether or not there is a pruchase associated with this listing
	$_POST['purch_id'] = '1';
	// use the city value to place appropriate city code at the beginning of the instructions field 
	if (!$error) {
		if ($_POST['city'] == 2){
			$_POST['instructions'] = 'ShPk ' . $_POST['instructions'];
		}elseif ($_POST['city'] == 3){
			$_POST['instructions'] = 'StAb ' . $_POST['instructions'];
		}elseif ($_POST['city'] == 4){
			$_POST['instructions'] = 'StPl ' . $_POST['instructions'];
		}elseif ($_POST['city'] == 5){
			$_POST['instructions'] = 'SpGr ' . $_POST['instructions'];
		}elseif ($_POST['city'] == 6){
			$_POST['instructions'] = 'Beaumont ' . $_POST['instructions'];
		}elseif ($_POST['city'] == 7){
			$_POST['instructions'] = 'Leduc ' . $_POST['instructions'];
		}elseif ($_POST['city'] == 8){
			$_POST['instructions'] = 'FtSk ' . $_POST['instructions'];
		}elseif ($_POST['city'] == 9){
			$_POST['instructions'] = 'Devon ' . $_POST['instructions'];
		}
	}
	mysql_free_result($getService);
}

function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $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;
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

// wraps entire insert record behavior in a conditional stament based on whether the $error array is empty
if (!$error) {
	if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "residential")) {
	  	$insertSQL = sprintf("INSERT INTO residential (user_id, dt_enter, dt_service, cust_id, service_id, address, quadrant, city, vendor, `zone`, listers, signs, co_listing, co_value, status, instructions, hanger1, hanger2, hanger3, topper, amount, price) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
						   GetSQLValueString($_POST['user_id'], "int"),
						   GetSQLValueString($_POST['dt_enter'], "date"),
						   GetSQLValueString($_POST['dt_service'], "date"),
						   GetSQLValueString($_POST['realtor_id'], "int"),
						   GetSQLValueString($_POST['service_id'], "int"),
						   GetSQLValueString($_POST['address'], "text"),
						   GetSQLValueString($_POST['quadrant'], "int"),
						   GetSQLValueString($_POST['city'], "int"),
						   GetSQLValueString($_POST['vendor'], "text"),
						   GetSQLValueString($_POST['zone'], "int"),
						   GetSQLValueString($_POST['listers'], "int"),
						   GetSQLValueString($_POST['signs'], "int"),
						   GetSQLValueString($_POST['co_listing'], "int"),
						   GetSQLValueString($_POST['co_value'], "text"),
						   GetSQLValueString($_POST['status'], "int"),
						   GetSQLValueString($_POST['instructions'], "text"),
						   GetSQLValueString($_POST['hanger1'], "text"),
						   GetSQLValueString($_POST['hanger2'], "text"),
						   GetSQLValueString($_POST['hanger3'], "text"),
						   GetSQLValueString($_POST['topper'], "text"),
						   GetSQLValueString($_POST['amount'], "double"),
						   GetSQLValueString($_POST['price'], "double"));
	
		mysql_select_db($database_regentAdmin, $regentAdmin)
		or die("can't connect to database");
		
		$Result1 = mysql_query($insertSQL, $regentAdmin);

		// assign a session tracking variable when record is inserted
		if ($Result1 === TRUE){
    		echo "test has been passed";
    		$_SESSION['success'] = 1;
    		$_SESSION['rltr_firstName'] = $row_getCustInfo['txtFirstName'];
    		$_SESSION['rltr_familyName'] = $row_getCustInfo['txtLastName'];
    		$_SESSION['address'] = $_POST['address'];
    		echo 'click <a href="comp_submissions.php"> here </a>to go to the next page';
		}else{
    		echo "problem writing to database ". mysql_error() ; 
		}
	  
		$insertGoTo = "comp_submissions.php";
		if (isset($_SERVER['QUERY_STRING'])) {
			$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
			$insertGoTo .= $_SERVER['QUERY_STRING'];
		}
		header(sprintf("Location: %s", $insertGoTo));
		
		// if the record has been inserted, clear the POST array
		$_POST = array();
	}
}
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">[/URL]
<html xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml">[/URL]
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>E-Request Office Manager Submisions</title>
<link href="../styles/admin_erequest.css" rel="stylesheet" type="text/css" media="screen" />
</head>

<body>
<div id="wrapper">
  <div id="titlebar">
    <div id="tpmenu"> <a href="../index.php">HOME</a>
	<a href="er_menu.php">MENU</a> </div>
  </div>
  <div id="content">
  	<h1>COMPANY E-REQUEST FORM</h1>
	<?php if (!empty($_SESSION['username'])){ echo '<p><span class="radioLabel">Welcome, '.$_SESSION['first_name'].' '.$_SESSION['family_name'].'</span> '; } ?></p>
	<p><span class="radioLabel">DATE:</span> <?php echo date('d/m/Y g:i A'); ?></p>
	<p id="terms">	  Only entries <strong>BEFORE</strong> 1:00 PM will be eligable for &quot;Next Day Service.&quot;</p>
	<?php
		// display alerts that were created during user input validation
		if ($error) {
		  echo '<ul>';
		  foreach ($error as $alert) {
			echo "<li class='warning'>$alert</li>\n";
			}
		  echo '</ul>';
		  }
	?><br />
	<?php 
		// uses the return value of the insert query function to display a success or error message.
		if(isset($_SESSION['success']) && $_SESSION['success'] == 1){
            echo "<p class='success'><strong>The following record was sucessfully submitted:</strong></p><p class='success'>REALTOR: ".$_SESSION['rltr_firstName']." ".$_SESSION['rltr_familyName']."<br />ADDRESS: ".$_SESSION['address']."</p>";
        }elseif(isset($_SESSION['success']) && $_SESSION['success'] != 1){
             echo "<p class='success'>Record submission failed.  Please try again.<br />If problem persits, contact the Regent Signs office.</p>";
        }
	 ?>
	<form action="<?php echo $editFormAction; ?>" id="residential" name="residential" method="POST">
       	<p id="terms"> Click on the column heading to recieve help on how to submit your listing. </p>
		<table width="100%" align="center" id="striped">
        <label><tr>
		  <th scope="col"><a href="../help/help.php#help_service_date" target="_blank">Service Date<br />
	      (dd/mm/yyyy)</a></th>
		  <th id="form" scope="col"><a href="../help/help.php#help_realtor" target="_blank">Realtor</a></th>
		  <th scope="col"><a href="../help/help.php#help_service" target="_blank">Service</a></th>
		  <th scope="col"><a href="../help/help.php#help_address" target="_blank">Address</a></th>
		  <th scope="col"><a href="../help/help.php#help_quadrant" target="_blank">Qdnt</a></th>
		  <th scope="col"><a href="../help/help.php#help_city" target="_blank">City</a></th>
		  <th scope="col"><a href="../help/help.php#help_vendor" target="_blank">Vendor</a></th>
		  <th scope="col"><a href="../help/help.php#help_mls" target="_blank">MLS Zone</a></th>
		  <th scope="col"><a href="../help/help.php#help_listers" target="_blank">Listers</a></th>
		  <th scope="col"><a href="../help/help.php#help_signs" target="_blank">Signs</a></th>
        </tr></label>
        <tr>
          <td><div align="center">
            <input name="dt_service" type="text" id="dt_service" value="<?php $tomorrow = mktime(0, 0, 0, date("m"), date("d")+1, date("y")); echo date('d/m/Y', $tomorrow); ?>" size="15" maxlength="10" />
          </div></td>
          <td><div align="center">
            <select name="realtor_id" class="mediumbox" id="realtor_id">
              <option value=""></option>
              <?php
do {  
?><option value="<?php echo $row_getRealtors['idsCustomerID']?>"<?php if (isset($_POST['realtor_id']) && $_POST['realtor_id']==($row_getRealtors['idsCustomerID'])){echo ' selected="selected"' ;} ?>><?php echo $row_getRealtors['Realtor']?></option>
              <?php
} while ($row_getRealtors = mysql_fetch_assoc($getRealtors));
  $rows = mysql_num_rows($getRealtors);
  if($rows > 0) {
      mysql_data_seek($getRealtors, 0);
	  $row_getRealtors = mysql_fetch_assoc($getRealtors);
  }
?>
            </select>
          </div></td>
          <td>
           	  <div align="center">
           	    <select name="service_id" id="service_id">
				  <option value=""></option>
           	      <option value="1"<?php if (empty($_POST)){ echo ' selected="selected"' ;}elseif (isset($_POST['service_id']) && $_POST['service_id'] == 1 || $_POST['service_id'] == 2 || $_POST['service_id'] == 3){echo ' selected="selected"' ;} ?>>Up</option>
           	      <option value="2"<?php if (empty($_POST)){}elseif (isset($_POST['service_id']) && $_POST['service_id'] == 8 || $_POST['service_id'] == 9 || $_POST['service_id'] == 10){echo ' selected="selected"' ;} ?>>Down</option>
           	      <option value="3"<?php if (empty($_POST)){}elseif (isset($_POST['service_id']) && $_POST['service_id'] == 15 || $_POST['service_id'] == 16 || $_POST['service_id'] == 17){echo ' selected="selected"' ;} ?>>Fix</option>
           	      <option value="4"<?php if (empty($_POST)){}elseif (isset($_POST['service_id']) && $_POST['service_id']==43){echo ' selected="selected"' ;} ?>>Cnd Up</option>
           	      <option value="5"<?php if (empty($_POST)){}elseif (isset($_POST['service_id']) && $_POST['service_id']==44){echo ' selected="selected"' ;} ?>>Cnd Down</option>
       	        </select>
       	    </div></td>
          <td>           	  
		   <div align="center">
            <input value="<?php 
			if (isset($_POST['address'])){
				if (isset($_POST['quadrant']) && $_POST['quadrant']==1){
					echo $_POST['address'];
				}elseif (isset($_POST['quadrant']) && $_POST['quadrant']==2){
					$str_address = str_replace(" SW", "", $_POST['address']);
					echo $str_address;
				}else{
					echo $_POST['address'];
				}
			}
			?>" name="address" type="text" id="address" maxlength="30" />
          </div></td>
          <td><select name="quadrant" id="quadrant">
            <option value="1" <?php if (isset($_POST['quadrant']) && $_POST['quadrant']==1){echo ' selected="selected"' ;}else{echo ' selected="selected"' ;} ?>>NW</option>
            <option value="2" <?php if (isset($_POST['quadrant']) && $_POST['quadrant']==2){echo ' selected="selected"' ;} ?>>SW</option>
          </select>
          </td>
          <td>
           	  <div align="center">
           	    <select name="city" id="city">
 				  <option value=""></option>
           	      <option value="6"<?php if (isset($_POST['city']) && $_POST['city']==6){echo ' selected="selected"' ;} ?>>Beaumont</option>
           	      <option value="9"<?php if (isset($_POST['city']) && $_POST['city']==9){echo ' selected="selected"' ;} ?>>Devon</option>
           	      <option value="1"<?php if (empty($_POST)){ echo ' selected="selected"' ;}elseif (isset($_POST['city']) && $_POST['city']==1){echo ' selected="selected"' ;} ?>>Edmonton</option>
           	      <option value="8"<?php if (isset($_POST['city']) && $_POST['city']==8){echo ' selected="selected"' ;} ?>>Ft. Saskatchewan</option>
           	      <option value="7"<?php if (isset($_POST['city']) && $_POST['city']==7){echo ' selected="selected"' ;} ?>>Leduc</option>
           	      <option value="2"<?php if (isset($_POST['city']) && $_POST['city']==2){echo ' selected="selected"' ;} ?>>Sherwood Park</option>
           	      <option value="5"<?php if (isset($_POST['city']) && $_POST['city']==5){echo ' selected="selected"' ;} ?>>Spruce Grove</option>
           	      <option value="3"<?php if (isset($_POST['city']) && $_POST['city']==3){echo ' selected="selected"' ;} ?>>St. Albert</option>
           	      <option value="4"<?php if (isset($_POST['city']) && $_POST['city']==4){echo ' selected="selected"' ;} ?>>Stony Plain</option>
       	        </select>
       	    </div></td>
          <td>           	  <div align="center">
            <input value="<?php if (isset($_POST['vendor'])){
echo $_POST['vendor'];} ?>" name="vendor" type="text" id="vendor" maxlength="30" />
          </div></td>
          <td>
           	  <div align="center">
           	    <select name="zone" id="zone">
				  <option value=""></option>
           	      <option value="1"<?php if (isset($_POST['zone']) && $_POST['zone']==1){echo ' selected="selected"' ;} ?>>1 Edm</option>
           	      <option value="2"<?php if (isset($_POST['zone']) && $_POST['zone']==2){echo ' selected="selected"' ;} ?>>2 Edm</option>
           	      <option value="3"<?php if (isset($_POST['zone']) && $_POST['zone']==3){echo ' selected="selected"' ;} ?>>3 Edm</option>
           	      <option value="4"<?php if (isset($_POST['zone']) && $_POST['zone']==4){echo ' selected="selected"' ;} ?>>4 Edm</option>
           	      <option value="5"<?php if (isset($_POST['zone']) && $_POST['zone']==5){echo ' selected="selected"' ;} ?>>5 Edm</option>
           	      <option value="6"<?php if (isset($_POST['zone']) && $_POST['zone']==6){echo ' selected="selected"' ;} ?>>6 Edm</option>
           	      <option value="7"<?php if (isset($_POST['zone']) && $_POST['zone']==7){echo ' selected="selected"' ;} ?>>7 Edm</option>
           	      <option value="8"<?php if (isset($_POST['zone']) && $_POST['zone']==8){echo ' selected="selected"' ;} ?>>8 Edm</option>
           	      <option value="9"<?php if (isset($_POST['zone']) && $_POST['zone']==9){echo ' selected="selected"' ;} ?>>9 Edm</option>
           	      <option value="10"<?php if (isset($_POST['zone']) && $_POST['zone']==10){echo ' selected="selected"' ;} ?>>10 Edm</option>
           	      <option value="11"<?php if (isset($_POST['zone']) && $_POST['zone']==11){echo ' selected="selected"' ;} ?>>11 Edm</option>
           	      <option value="12"<?php if (isset($_POST['zone']) && $_POST['zone']==12){echo ' selected="selected"' ;} ?>>12  Edm</option>
           	      <option value="13"<?php if (isset($_POST['zone']) && $_POST['zone']==13){echo ' selected="selected"' ;} ?>>13 Edm</option>
           	      <option value="14"<?php if (isset($_POST['zone']) && $_POST['zone']==14){echo ' selected="selected"' ;} ?>>14 Edm</option>
           	      <option value="15"<?php if (isset($_POST['zone']) && $_POST['zone']==15){echo ' selected="selected"' ;} ?>>15 Edm</option>
           	      <option value="16"<?php if (isset($_POST['zone']) && $_POST['zone']==16){echo ' selected="selected"' ;} ?>>16 Edm</option>
           	      <option value="17"<?php if (isset($_POST['zone']) && $_POST['zone']==17){echo ' selected="selected"' ;} ?>>17 Edm</option>
           	      <option value="18"<?php if (isset($_POST['zone']) && $_POST['zone']==18){echo ' selected="selected"' ;} ?>>18 Edm</option>
           	      <option value="19"<?php if (isset($_POST['zone']) && $_POST['zone']==19){echo ' selected="selected"' ;} ?>>19 Edm</option>
           	      <option value="20"<?php if (isset($_POST['zone']) && $_POST['zone']==20){echo ' selected="selected"' ;} ?>>20 Edm</option>
           	      <option value="21"<?php if (isset($_POST['zone']) && $_POST['zone']==21){echo ' selected="selected"' ;} ?>>21 Edm</option>
           	      <option value="22"<?php if (isset($_POST['zone']) && $_POST['zone']==22){echo ' selected="selected"' ;} ?>>22 Edm</option>
           	      <option value="23"<?php if (isset($_POST['zone']) && $_POST['zone']==23){echo ' selected="selected"' ;} ?>>23 Edm</option>
           	      <option value="24"<?php if (isset($_POST['zone']) && $_POST['zone']==24){echo ' selected="selected"' ;} ?>>24 St. Albert</option>
           	      <option value="25"<?php if (isset($_POST['zone']) && $_POST['zone']==25){echo ' selected="selected"' ;} ?>>25 Sher Park</option>
           	      <option value="26"<?php if (isset($_POST['zone']) && $_POST['zone']==26){echo ' selected="selected"' ;} ?>>26 Edm</option>
           	      <option value="27"<?php if (isset($_POST['zone']) && $_POST['zone']==27){echo ' selected="selected"' ;} ?>>27 Edm</option>
           	      <option value="28"<?php if (isset($_POST['zone']) && $_POST['zone']==28){echo ' selected="selected"' ;} ?>>28 Edm</option>
           	      <option value="29"<?php if (isset($_POST['zone']) && $_POST['zone']==29){echo ' selected="selected"' ;} ?>>29 Edm</option>
           	      <option value="30"<?php if (isset($_POST['zone']) && $_POST['zone']==30){echo ' selected="selected"' ;} ?>>30 Edm</option>
           	      <option value="35"<?php if (isset($_POST['zone']) && $_POST['zone']==35){echo ' selected="selected"' ;} ?>>35 Edm</option>
           	      <option value="40"<?php if (isset($_POST['zone']) && $_POST['zone']==40){echo ' selected="selected"' ;} ?>>40 Edm</option>
           	      <option value="41"<?php if (isset($_POST['zone']) && $_POST['zone']==41){echo ' selected="selected"' ;} ?>>41 Edm</option>
           	      <option value="42"<?php if (isset($_POST['zone']) && $_POST['zone']==42){echo ' selected="selected"' ;} ?>>42 Edm</option>
           	      <option value="50"<?php if (isset($_POST['zone']) && $_POST['zone']==50){echo ' selected="selected"' ;} ?>>50 Edm</option>
           	      <option value="51"<?php if (isset($_POST['zone']) && $_POST['zone']==51){echo ' selected="selected"' ;} ?>>51 Edm</option>
           	      <option value="52"<?php if (isset($_POST['zone']) && $_POST['zone']==52){echo ' selected="selected"' ;} ?>>52 Edm</option>
           	      <option value="53"<?php if (isset($_POST['zone']) && $_POST['zone']==53){echo ' selected="selected"' ;} ?>>53 Edm</option>
           	      <option value="54"<?php if (isset($_POST['zone']) && $_POST['zone']==54){echo ' selected="selected"' ;} ?>>54 Edm</option>
           	      <option value="55"<?php if (isset($_POST['zone']) && $_POST['zone']==55){echo ' selected="selected"' ;} ?>>55 Edm</option>
           	      <option value="56"<?php if (isset($_POST['zone']) && $_POST['zone']==56){echo ' selected="selected"' ;} ?>>56 Edm</option>
           	      <option value="57"<?php if (isset($_POST['zone']) && $_POST['zone']==57){echo ' selected="selected"' ;} ?>>57 Edm</option>
           	      <option value="58"<?php if (isset($_POST['zone']) && $_POST['zone']==58){echo ' selected="selected"' ;} ?>>58 Edm</option>
           	      <option value="59"<?php if (isset($_POST['zone']) && $_POST['zone']==59){echo ' selected="selected"' ;} ?>>59 Edm</option>
           	      <option value="62"<?php if (isset($_POST['zone']) && $_POST['zone']==62){echo ' selected="selected"' ;} ?>>62 Ft. Sask</option>
           	      <option value="81"<?php if (isset($_POST['zone']) && $_POST['zone']==81){echo ' selected="selected"' ;} ?>>81 Leduc</option>
           	      <option value="82"<?php if (isset($_POST['zone']) && $_POST['zone']==82){echo ' selected="selected"' ;} ?>>82 Beaumont</option>
           	      <option value="91"<?php if (isset($_POST['zone']) && $_POST['zone']==91){echo ' selected="selected"' ;} ?>>91 Sp. Grove</option>
           	      <option value="91"<?php if (isset($_POST['zone']) && $_POST['zone']==91){echo ' selected="selected"' ;} ?>>91 St. Plain</option>
           	      <option value="92"<?php if (isset($_POST['zone']) && $_POST['zone']==92){echo ' selected="selected"' ;} ?>>92 Devon</option>
       	        </select>
       	    </div></td>
          <td>           	  <div align="center">
            <input name="listers" type="text" id="listers" value="<?php if (isset($_POST['listers'])){
echo $_POST['listers'];}else{ echo '1'; } ?>" size="4" maxlength="1" />
          </div></td>
          <td>           	  <div align="center">
            <input name="signs" type="text" id="signs" value="<?php if (isset($_POST['signs'])){
echo $_POST['signs'];}else{ echo '1'; } ?>" size="4" />
          </div></td>
        </tr>
      </table>
	  <p><label id="blueLable"><a href="../help/help.php#help_instructions" target="_blank">Instructions:</a></label>
	  <input value="<?php if (isset($_POST['instructions'])){
echo $_POST['instructions'];} ?>" name="instructions" type="text" class="widebox" id="instructions" maxlength="60" />
	  </p>
	  <p>
	    <label id="blueLable"><a href="../help/help.php#help_hangers" target="_blank">Hanger 1:</a></label>
	    <input value="<?php if (isset($_POST['hanger1'])){
echo $_POST['hanger1'];} ?>" name="hanger1" type="text" class="mediumbox" id="hanger1" />
	    <label id="blueLable"><a href="../help/help.php#help_hangers" target="_blank">Hanger 2:</a></label>
	    <input value="<?php if (isset($_POST['hanger2'])){
echo $_POST['hanger2'];} ?>" name="hanger2" type="text" class="mediumbox" id="hanger2" />
	    <label id="blueLable"><a href="../help/help.php#help_hangers" target="_blank">Hanger 3:</a></label>
	    <input value="<?php if (isset($_POST['hanger3'])){
echo $_POST['hanger3'];} ?>" name="hanger3" type="text" class="mediumbox" id="hanger3" />
	  </p>
	  <p>
	    <label id="blueLable"><a href="../help/help.php#help_toppers" target="_blank">Topper:</a></label>
	    <input value="<?php if (isset($_POST['topper'])){
echo $_POST['topper'];} ?>" name="topper" type="text" class="mediumbox" id="topper" />
      </p>
	  <p id="terms"><strong>NOTE:</strong> All hangers and toppers are in addition to the default hangers in your &quot;Customer Preferences&quot; and will be custome made at $9.00 per hanger / topper. <br />
      Follow the column heading links for more information </p>
	  <p>
        <input name="insert" type="submit" id="insert" value="Insert Record" />
      
	    <input name="co_value" type="hidden" id="co_value" />
        <input name="co_listing" type="hidden" id="co_listing" />
        <input name="status" type="hidden" id="status" />
        <input name="amount" type="hidden" id="amount" />
        <input name="price" type="hidden" id="price" />
        <input name="user_id" type="hidden" id="user_id" value="<?php echo $_SESSION['user_id']; ?>" />
        <input name="dt_enter" type="hidden" id="dt_enter" />
</p>
      
      <input type="hidden" name="MM_insert" value="residential">
    </form>
    <p>Click    	      <?php if ($_SESSION['comp_priv']=='y'){
		  	 echo "<a href='comp_daily_log.php'>HERE</a>";
		  }else{
		     echo "<a href='indv_daily_log.php'>HERE</a>";
		  }
		  ?> to see a list of all confirmed entries for today </p>
	<p>&nbsp;</p>
	<p><span class="radioLabel"><a href="../help/help.php#help_terms">REVIEW</a> THE REGENT SIGNS E-REQUEST TERMS AND CONDITIONS: </span></p>
  </div>
</div>
<?php 
echo "<pre>";
echo "Sessions <br/>";
print_r($_SESSION);

echo "Cookies<br/>";
print_r($_COOKIE);

echo "</pre>";
?>
</body>
</html>
<?php
mysql_free_result($getRealtors);

mysql_free_result($getCustInfo);

?>
 
and the includes at the top ? can you provide these (minus any passwords etc).
 
here is the content of the style css sheet

Code:
html, body {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	color: #003399;
	background: #FFF;
	margin: 2px;
	padding:0;
	height: 101%;
	}
#wrapper {
	width: 1024px;
	margin: 0;
	}
#titlebar {
	background: url(../main_images/header.jpg) top left no-repeat;
	width: 870px;
	height: 145px;
	margin: 0;
	padding: 0;
	color: #FFF;
	font-size: 100%;
	float:left;
	}
#tpmenu {
	font-family:Verdana, Arial, Helvetica, sans-serif;
	font-size:90%;
	float:right;
	margin: 0 30px 0 0;
	padding: 0;
	height: 78px;
	}
#tpmenu a, #tpmenu a:link, #tpmenu a:visited, #tpmenu a:active{
	background:url(../main_images/tpMenu_blank.jpg) top left no-repeat;
	font-family:Verdana, Arial, Helvetica, sans-serif;
	color:#FFFFFF;
	text-decoration:none;
	font-size:90%;
	float:right;
	margin: 67px 25px 0 0;
	padding: 40px 0 0 16px;
	}
#tpmenu a:hover {
	background:url(../main_images/tpMenu_active.jpg) top left no-repeat;
	font-family:Verdana, Arial, Helvetica, sans-serif;
	color:#FFFFFF;
	text-decoration:none;
	font-size:90%;
	font-weight:bold;
	float:right;
	margin: 67px 35px 0 0;
	padding: 40px 0px 0 24px;
	}
#menu {
	background: url(../main_images/admin_login.jpg) top left no-repeat;
	width: 220px;
	height: 377px;
	margin: 0;
	padding: 0;
	color: #FFF;
	font-size: 100%;
	float:left;
	}
#menuheader {
	height: 30px;
	font-size: 100%;
	margin:0;
	padding: 11px 0 0 60px;
	}
#menumain {
	margin:0;
	padding: 0 20px 0 35px;
	font-size: 80%;
	}
#menumain a, #menumain a:link, #menumain a:visited, #menumain a:active {
	font-family:Verdana, Arial, Helvetica, sans-serif;
	color:#FFF;
	text-decoration:none;	
	}
#menumain a:hover{
	font-size:120%;
	color:#FFFF00;
	}
#content a, #content a:link, #content a:visited, #content a:active {
	font-family:Verdana, Arial, Helvetica, sans-serif;
	text-decoration:none;
	}
#content {
	font-size:80%;
	float:left;
	border-left:#000066 medium;
	width: 1024px;
	}
#content p {
	margin: 0 25px 0 20px;
	padding: 5px 10px 5px 0;
	line-height: 1.2;
	}
#content h1, #content h2 {
	margin: 0 0 5px 30px;
	padding: 5px 0 0;
	font-family:Verdana, Arial, Helvetica, sans-serif;
	color:#000066;
	}
#content h1 {
	font-size: 130%;
	}
#content h2 {
	font-size:100%;
	}
#content h3 {
	background-color:#DFECFF;
	margin: 0 0 0 20px;
	padding: 5px 0 5px 0;
	font-family:Verdana, Arial, Helvetica, sans-serif;
	color:#000066;
	width:900 px;
	font-size:100%;
}
#content h4 {
	background-color:#FAF77C;
	margin: 5px 0 5px 20px;
	padding: 5px 0 5px 0;
	font-family:Verdana, Arial, Helvetica, sans-serif;
	color:#000066;
	width:900 px;
	font-size:100%;
}
/* inclued content */
form {
	margin: 10px 0px 0 5px;
	border-color: #003399;
	border-style: solid;
	border-width: thin;
  }
form a, form a:link, form a:visited, form a:active {
  text-decoration:none;
  font-family:Verdana, Arial, Helvetica, sans-serif;
  color:#FFF;
  }
form a:hover {
  text-decoration:none;
  font-family:Verdana, Arial, Helvetica, sans-serif;
  color:#FFFF00;
  }
#blueLable{
  font-size:100%;
  background-color:#003366;
  margin: 0;
  padding: 3px 6px 3px 10px;
  color:#FFFFFF;
  }
table {
  margin-left: 0px;
  }
.mediumbox {
  width: 200px;
  }
.widebox {
  width: 500px;
  }
textarea {
  width: 500px;
  height: 100px;
  }
.contentbox {
	height: 200px;
	border: #003399;
  }
label, .warning, .radioLabel {
  font-family:Verdana, Arial, Helvetica, sans-serif;
  font-weight: bold;
  }
.warning {
  color:#F00;
  }
.success {
	color:#006633;
}
td.centered {
  text-align: center;
  }
#striped th {
  background:#003366;
  color:#FFFFFF;
  }
#striped td {
  padding: 2px 2px 2px 0;
  vertical-align: top;
  }
/* This gives odd-numbered rows a pale gray background */
#striped tr {
  background-color:#eee;
  }
#striped tr.hilite {
  background-color:#E8F2F8;
  }
tr.hilite {
  background-color:#E8F2F8;
  }
#terms{
	font-size:75%;
}

and here is the regentAdmin connections file

Code:
<?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_regentAdmin = "*******";
$database_regentAdmin = "*****";
$username_regentAdmin = "*******";
$password_regentAdmin = "*******";
$regentAdmin = mysql_pconnect($hostname_regentAdmin, $username_regentAdmin, $password_regentAdmin) or trigger_error(mysql_error(),E_USER_ERROR); 
?>

and here is the regent select file

Code:
<?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_regentSelect = "db003.zabco.net";
$database_regentSelect = "*****";
$username_regentSelect = "*****";
$password_regentSelect = "*****";
$regentSelect = mysql_pconnect($hostname_regentSelect, $username_regentSelect, $password_regentSelect) or trigger_error(mysql_error(),E_USER_ERROR); 
?>
 
right

1. comment out the block of code as follows:
Code:
      /*
        $insertGoTo = "comp_submissions.php";
        if (isset($_SERVER['QUERY_STRING'])) {
            $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
            $insertGoTo .= $_SERVER['QUERY_STRING'];
        }
        header(sprintf("Location: %s", $insertGoTo));
        
        // if the record has been inserted, clear the POST array
        $_POST = array();
		*/

2. replace the code block as follows:
Code:
echo 'click <a href="comp_submissions.php'.getformattedqstr().'"> here </a>to go to the next page';

3. add this function
Code:
function getformattedqstr(){
		if (isset($_GET)):
			$str = "";
			foreach ($_GET as $key=>$val):
				$qstr .= $key."=".$val.'&'; 
			endforeach;
			$qstr=rtrim($qstr, "&");
			return (empty($qstr) ? "" : "$$qstr";
		else:
                        return "";
                endif;

4 replace comp_submissions.php temporarily with the following

Code:
<?
session_start();
echo "<pre>";
echo "sessions<br/>";
print_r($_SESSION);
echo "cookies<br/>;
print_r($_COOKIE);
echo "</pre>";
?>

pls post back the output from the vardump in comp_submission above.
 
sorry,

i am not sure what you mean by this:
4 replace comp_submissions.php temporarily with the following

do you mean take out everything within the html tags?

also, I had to change the function as I was getting errors to this:
Code:
function getformattedqstr(){
        if (isset($_GET)){
            $str = "";
            foreach ($_GET as $key=>$val):
                $qstr .= $key."=".$val.'&'; 
            endforeach;
            $qstr=rtrim($qstr, "&");
            return (empty($qstr) ? "" : "$$qstr");
        }else{
            return "";
        }
}
is that okay?
 
pls change this line
Code:
return (empty($qstr) ? "" : "$$qstr");
to
Code:
return (empty($qstr) ? "" : "?" . $qstr);

for item 4 - i really meant swap the files. ie. change the name of the current comp_submissions.php to comp_submissions.php.old and then create a new file called comp_submissions.php and shove the code above into it.

i.e. we are just trying to make sure that the session data is properly transferred to the referred file. you will need to click on the link to move to the next page as for the time being we have taken the header redirect out.
 
here are the results:
Code:
sessionsArray
(
    [MM_Username] => rxPolaris
    [MM_UserGroup] => y
    [username] => rxPolaris
    [user_id] => 8
    [cust_id] => 1616
    [first_name] => Realty Executives
    [family_name] => Polaris Office
    [comp_priv] => y
    [comp_id] => 105
    [success] => 1
    [rltr_firstName] => Scott
    [rltr_familyName] => Chomin
    [address] => 203, 4657-25 st
)
cookiesArray
(
    [PHPSESSID] => b165435722897809130c0910a319096e
)

It looks like it is working when the header redirect is taken out of it?
 
hello,

I thought that maybe the issue would be solved if the page did not redirect to itself. So i reinserted the header redirect to another page. It did not work. Something about the header redirect is killing the session variables that get set on the same page.

this is the result I got using the header redirect to your version of comp_submissions above

Code:
sessionsArray
(
    [MM_Username] => rxPolaris
    [MM_UserGroup] => y
    [username] => rxPolaris
    [user_id] => 8
    [cust_id] => 1616
    [first_name] => Realty Executives
    [family_name] => Polaris Office
    [comp_priv] => y
    [comp_id] => 105
)
cookiesArray
(
    [PHPSESSID] => 22c49877951a82ff7e851196c1b11507
)

it does not contain the session variables set on the previous page.
 
hi there

i can't replicate this behaviour even on a slow localhost that i have got; so a last gasp effort before just advising you to upgrade !:

can you add
Code:
session_write_close();
before the header("Location..."); call?

and also instantiate the variables at the top of the code before setting them below (this seems to be a timing issue - you are arriving at the new page before the server has had a chance to finish writing the session data from the last page -
i also normally add an exit; after the header redirect but i have read that this mucks up the session_write_close (although can't see why myself). i'd try it with and then without. ideally you would use the exit call.

Justin
 
I think the session_write_close(); fixed it!!!!!!

wow, I will try it out and test it from every angle and let you know.

I thank you for your time and wish I could offer more than a few stars and a hearty thanks.

So thanks **

Jk
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top