Hi All,
I have a script that contains a SESSION var, when the script runs I am trying to use the SESSION var as a part of the URL query string.
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form4")) {
$updateSQL = sprintf("UPDATE coupon SET `comment`=%s, discount=%s, begin_date=%s, expire_date=%s WHERE code=%s",
GetSQLValueString($_POST['comment'], "text"),
GetSQLValueString($_POST['discount'], "text"),
GetSQLValueString($_POST['begin_date'], "date"),
GetSQLValueString($_POST['expire_date'], "date"),
GetSQLValueString($_POST['code'], "text"));
mysql_select_db($database_test, $test);
$Result1 = mysql_query($updateSQL, $test) or die(mysql_error());
$updateGoTo = "view_subagent.php?member_id=$_SESSION['member_id_p']";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
The section I am working on s:
mysql_select_db($database_test, $test);
$Result1 = mysql_query($updateSQL, $test) or die(mysql_error());
$updateGoTo = "view_subagent.php?member_id=$_SESSION['member_id_p']";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
The line: $updateGoTo = "view_subagent.php"; work fine but I need to attach a query on the end like:
$updateGoTo = "view_subagent.php?member_id=$_SESSION['member_id_p']";
When I run the script as is I get the following error:
Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING
What am I missing, can anyone see.