PDA

View Full Version : Update page redirect problems


gbgnyco367794
07-21-2009, 09:44 AM
I am creating a multiple step process and need an update page to send the sales_id to the next page...I am not very good with php and cant figure out why this will not work....any help?

here is the current code:
<?php
// WA Application Builder Update
if (isset($_POST["Update_x"])) // Trigger
{
$WA_connection = $a;
$WA_table = "sales";
$WA_redirectURL = "contractchoice.php";
$WA_keepQueryString = false;
$WA_indexField = "sales_id";
$WA_fieldNamesStr = "Date_of_funding|Check_Number|Funding_amount|Fundin g_fee|interest|Investor|Approved_by|Approved|Comme nts|admifee|delfee|underid";
$WA_fieldValuesStr = "".((isset($_POST["Date_of_funding"]))?$_POST["Date_of_funding"]:"") ."" . "|" . "".((isset($_POST["Check_Number"]))?$_POST["Check_Number"]:"") ."" . "|" . "".((isset($_POST["Funding_amount"]))?$_POST["Funding_amount"]:"") ."" . "|" . "".((isset($_POST["Funding_fee"]))?$_POST["Funding_fee"]:"") ."" . "|" . "".((isset($_POST["interest"]))?$_POST["interest"]:"") ."" . "|" . "".((isset($_POST["Investor"]))?$_POST["Investor"]:"") ."" . "|" . "".((isset($_POST["Approved_by"]))?$_POST["Approved_by"]:"") ."" . "|" . "".((isset($_POST["Approved"]))?$_POST["Approved"]:"") ."" . "|" . "".((isset($_POST["Comments"]))?$_POST["Comments"]:"") ."" . "|" . "".((isset($_POST["admifee"]))?$_POST["admifee"]:"") ."" . "|" . "".((isset($_POST["delfee"]))?$_POST["delfee"]:"") ."" . "|" . "".((isset($_POST["underid"]))?$_POST["underid"]:"") ."";
$WA_columnTypesStr = "',none,''|',none,''|',none,''|',none,''|',none,''| ',none,''|',none,''|',none,''|',none,''|',none,''| ',none,''|',none,''";
$WA_comparisonStr = " LIKE | LIKE | LIKE | LIKE | LIKE | LIKE | LIKE | LIKE | LIKE | LIKE | LIKE | LIKE ";
$WA_fieldNames = explode("|", $WA_fieldNamesStr);
$WA_fieldValues = explode("|", $WA_fieldValuesStr);
$WA_columns = explode("|", $WA_columnTypesStr);

$WA_where_fieldValuesStr = "".((isset($_POST["WADAUpdateRecordID"]))?$_POST["WADAUpdateRecordID"]:"") ."";
$WA_where_columnTypesStr = "none,none,NULL";
$WA_where_comparisonStr = "=";
$WA_where_fieldNames = explode("|", $WA_indexField);
$WA_where_fieldValues = explode("|", $WA_where_fieldValuesStr);
$WA_where_columns = explode("|", $WA_where_columnTypesStr);
$WA_where_comparisons = explode("|", $WA_where_comparisonStr);

$WA_connectionDB = $database_a;
mysql_select_db($WA_connectionDB, $WA_connection);
if (!session_id()) session_start();
$updateParamsObj = WA_AB_generateInsertParams($WA_fieldNames, $WA_columns, $WA_fieldValues, -1);
$WhereObj = WA_AB_generateWhereClause($WA_where_fieldNames, $WA_where_columns, $WA_where_fieldValues, $WA_where_comparisons );
$WA_Sql = "UPDATE `" . $WA_table . "` SET " . $updateParamsObj->WA_setValues . " WHERE " . $WhereObj->sqlWhereClause . "";
$MM_editCmd = mysql_query($WA_Sql, $WA_connection) or die(mysql_error());
if ($WA_redirectURL != "") {
if ($WA_keepQueryString && $WA_redirectURL != "" && isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] !== "" && sizeof($_POST) > 0) {
$WA_redirectURL .= ((strpos($WA_redirectURL, '?') === false)?"?":"&").$_SERVER["QUERY_STRING"];
}
header("Location: ".$WA_redirectURL);
}
}
?>


I need the redirect to be

$WA_redirectURL = "contractchoice.php?sales_id=<?php echo(rawurlencode($row_WADAsales['sales_id'])) ?>";

Ray Borduin
07-21-2009, 11:02 AM
$WA_redirectURL = "contractchoice.php?sales_id=".rawurlencode($row_WADAsales['sales_id']);

gbgnyco367794
07-21-2009, 11:17 AM
had to take the space out of w ada but it works!!!

danne.polk73888
08-01-2009, 03:26 PM
Can you give an equivalent example in coldfusion?

$WA_redirectURL = "contractchoice.php?sales_id=".rawurlencode($row_W ADAsales['sales_id']);

The following doesn't pass the URL.salesID

<cfset WA_redirectURL = "bundle_Results.cfm?salesID=" & ToString(getSalesID.salesID) & "" />

Thanks,
dp

Eric Mittman
08-03-2009, 10:21 AM
The code you have looks like it should set the variable ok to me.

<cfset WA_redirectURL = "bundle_Results.cfm?salesID=" & ToString(getSalesID.salesID) & "" />

What is the result you are getting with this value? If there is nothing specified for the sales id then it is probably because the getSalesID.salesID does not have a value. Just before this line of code you should add in a cfoutput and print this value, you can follow that by a cfabort to stop the processing. When you test this out it should print the value to the screen. You will need to ensure this recordset variable has a value for it to link correctly.