Passing Session Vars to Next Page...
I've created an insert form using DataAssist, which is working fine... But I want to be able to pull up the details that are submitted to the database, on the next page.
So this is the code that has been generated for the insert page...
------------------------------------------------------------------------------------
<?php require_once("../Connections/EBP_con.php"); ?>
<?php require_once("../WA_DataAssist/WA_AppBuilder_PHP.php"); ?>
<?php
// WA Application Builder Insert
if (isset($_POST["Insert_x"])) // Trigger
{
$WA_connection = $EBP_con;
$WA_table = "UserDetails";
$WA_sessionName = "WADA_Insert_UserDetails";
$WA_redirectURL = "autolist.php";
$WA_keepQueryString = false;
$WA_indexField = "UserID";
$WA_fieldNamesStr = "FirstName|SecondName|Tel|Email|Username|Password";
$WA_fieldValuesStr = "".((isset($_POST["FirstName"]))?$_POST["FirstName"]:"") ."" . "|" . "".((isset($_POST["SecondName"]))?$_POST["SecondName"]:"") ."" . "|" . "".((isset($_POST["Tel"]))?$_POST["Tel"]:"") ."" . "|" . "".((isset($_POST["Email"]))?$_POST["Email"]:"") ."" . "|" . "".((isset($_POST["Username"]))?$_POST["Username"]:"") ."" . "|" . "".((isset($_POST["Password"]))?$_POST["Password"]:"") ."";
$WA_columnTypesStr = "',none,''|',none,''|',none,''|',none,''|',none,''|',none,''";
$WA_fieldNames = explode("|", $WA_fieldNamesStr);
$WA_fieldValues = explode("|", $WA_fieldValuesStr);
$WA_columns = explode("|", $WA_columnTypesStr);
$WA_connectionDB = $database_EBP_con;
mysql_select_db($WA_connectionDB, $WA_connection);
if (!session_id()) session_start();
$insertParamsObj = WA_AB_generateInsertParams($WA_fieldNames, $WA_columns, $WA_fieldValues, -1);
$WA_Sql = "INSERT INTO `" . $WA_table . "` (" . $insertParamsObj->WA_tableValues . ") VALUES (" . $insertParamsObj->WA_dbValues . ")";
$MM_editCmd = mysql_query($WA_Sql, $WA_connection) or die(mysql_error());
$_SESSION[$WA_sessionName] = mysql_insert_id();
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);
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Product Registration</title>
<meta http-equiv="Content-language" content="en-GB"/>
<meta name="rating" content="General"/>
<meta name="revisit-after" content="1 days"/>
<meta name="ROBOTS" content="ALL"/>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link href="/styles/global.css" rel="stylesheet" type="text/css" />
<link href="../WA_SecurityAssist/styles/Traditional_Pacifica.css" rel="stylesheet" type="text/css" />
<link href="../WA_SecurityAssist/styles/Arial.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="WADAInsertContainer">
<form action="Registration2.php" method="post" name="WADAInsertForm" id="WADAInsertForm">
<div class="WADAHeader">Insert Record</div>
<table class="WADADataTable" cellpadding="3" cellspacing="0" border="0">
<tr>
<th class="WADADataTableHeader">FirstName:</th>
<td class="WADADataTableCell"><input type="text" name="FirstName" id="FirstName" value="" size="32" /></td>
</tr>
<tr>
<th class="WADADataTableHeader">SecondName:</th>
<td class="WADADataTableCell"><input type="text" name="SecondName" id="SecondName" value="" size="32" /></td>
</tr>
<tr>
<th class="WADADataTableHeader">Tel:</th>
<td class="WADADataTableCell"><input type="text" name="Tel" id="Tel" value="" size="32" /></td>
</tr>
<tr>
<th class="WADADataTableHeader">Email:</th>
<td class="WADADataTableCell"><input type="text" name="Email" id="Email" value="" size="32" /></td>
</tr>
<tr>
<th class="WADADataTableHeader">Username:</th>
<td class="WADADataTableCell"><input type="text" name="Username" id="Username" value="" size="32" /></td>
</tr>
<tr>
<th class="WADADataTableHeader">Password:</th>
<td class="WADADataTableCell"><input type="password" name="Password" id="Password" value="" /></td>
</tr>
</table>
<div class="WADAButtonRow">
<table class="WADADataNavButtons" border="0" cellpadding="0" cellspacing="0">
<tr>
<td class="WADADataNavButtonCell" nowrap="nowrap"><input type="image" name="Insert" id="Insert" value="Insert" alt="Insert" src="../WA_DataAssist/images/Pacifica/Elemental_insert.gif" /></td>
<td class="WADADataNavButtonCell" nowrap="nowrap"><a href="UserDetails_Results.php" title="Cancel"><img border="0" name="Cancel" id="Cancel" alt="Cancel" src="../WA_DataAssist/images/Pacifica/Elemental_cancel.gif" /></a></td>
</tr>
</table>
<input name="WADAInsertRecordID" type="hidden" id="WADAInsertRecordID" value="" />
</div>
</form>
</div>
</body>
</html>
------------------------------------------------------------------------------------
And this is the code I've generated for the next page...
<?php require_once('../Connections/EBP_con.php'); ?>
<?php
$colname_Recordset1 = "-1";
if (isset($_SESSION['mysql_insert_id'])) {
$colname_Recordset1 = (get_magic_quotes_gpc()) ? $_SESSION['mysql_insert_id'] : addslashes($_SESSION['mysql_insert_id']);
}
mysql_select_db($database_EBP_con, $EBP_con);
$query_Recordset1 = sprintf("SELECT * FROM UserDetails WHERE UserID = %s", $colname_Recordset1);
$Recordset1 = mysql_query($query_Recordset1, $EBP_con) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<?php echo $row_Recordset1['FirstName']; ?><?php echo $row_Recordset1['SecondName']; ?> (
<?php echo $row_Recordset1['Email']; ?>) test6
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>
------------------------------------------------------------------------------------
As you can see, I'm expecting to see the name, second name and email address, after submitting the form! But it doesnt seem to work! Any ideas?
Thanks in Advance!