View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Passing Session Variables - Help?

Thread began 4/27/2009 7:23 am by phil.evans372967 | Last modified 4/28/2009 8:10 am by phil.evans372967 | 3415 views | 7 replies

phil.evans372967

Update

Thought I'd post my code as it may be helpful. Pulling may hair out trying to get this to work

<?php require_once("Connections/prop.php"); ?>
<?php require_once("WA_DataAssist/WA_AppBuilder_PHP.php"); ?>
<?php require_once('Connections/prop.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($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;
}
}

$colname_GetIDsForIms = "-1";
if (isset($_SESSION['prop_id'])) {
$colname_GetIDsForIms = (get_magic_quotes_gpc()) ? $_SESSION['prop_id'] : addslashes($_SESSION['prop_id']);
}
mysql_select_db($database_prop, $prop);
$query_GetIDsForIms = sprintf("SELECT prop_id, prop_ref FROM prop_details WHERE prop_id = %s ORDER BY prop_id ASC", GetSQLValueString($colname_GetIDsForIms, "int"));
$GetIDsForIms = mysql_query($query_GetIDsForIms, $prop) or die(mysql_error());
$row_GetIDsForIms = mysql_fetch_assoc($GetIDsForIms);
$totalRows_GetIDsForIms = mysql_num_rows($GetIDsForIms);?>
<?php
// WA Application Builder Insert
if (isset($_POST["Insert_x"])) // Trigger
{
$WA_connection = $prop;
$WA_table = "prop_images";
$WA_sessionName = "WADA_Insert_prop_images";
$WA_redirectURL = "prop_images_Insert.php";
$WA_keepQueryString = true;
$WA_indexField = "img_id";
$WA_fieldNamesStr = "img_id|img_thumb|img_main|prop_id|prop_ref";
$WA_fieldValuesStr = "".((isset($_POST["img_id"]))?$_POST["img_id"]:"") ."" . "|" . "".((isset($_POST["img_thumb"]))?$_POST["img_thumb"]:"") ."" . "|" . "".((isset($_POST["img_main"]))?$_POST["img_main"]:"") ."" . "|" . "".$row_GetIDsForIms['prop_id'] ."" . "|" . "".$row_GetIDsForIms['prop_ref'] ."";
$WA_columnTypesStr = "none,none,NULL|',none,''|',none,''|none,none,NULL|',none,''";
$WA_fieldNames = explode("|", $WA_fieldNamesStr);
$WA_fieldValues = explode("|", $WA_fieldValuesStr);
$WA_columns = explode("|", $WA_columnTypesStr);
$WA_connectionDB = $database_prop;
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=iso-8859-1" />
<title>Insert prop_images</title>
<link href="WA_DataAssist/styles/Refined_Pacifica.css" rel="stylesheet" type="text/css" />
<link href="WA_DataAssist/styles/Arial.css" rel="stylesheet" type="text/css" />
</head>

<body>

<div class="WADAInsertContainer">
<form action="prop_images_Insert.php" method="post" name="WADAInsertForm" id="WADAInsertForm">
<div class="WADAHeader">Insert Record</div>
<div class="WADAHorizLine"><img src="WA_DataAssist/images/_tx_.gif" alt="" height="1" width="1" border="0" /></div>
<table class="WADADataTable" cellpadding="0" cellspacing="0" border="0">
<tr>
<th class="WADADataTableHeader">img_id:</th>
<td class="WADADataTableCell"><input type="hidden" name="img_id" id="img_id" value="" /></td>
</tr>
<tr>
<th class="WADADataTableHeader">img_thumb:</th>
<td class="WADADataTableCell"><input type="text" name="img_thumb" id="img_thumb" value="" size="32" /></td>
</tr>
<tr>
<th class="WADADataTableHeader">img_main:</th>
<td class="WADADataTableCell"><input type="text" name="img_main" id="img_main" value="" size="32" /></td>
</tr>
<tr>
<th class="WADADataTableHeader">prop_id:</th>
<td class="WADADataTableCell"><?php echo $row_GetIDsForIms['prop_id']; ?></td>
</tr>
<tr>
<th class="WADADataTableHeader">prop_ref:</th>
<td class="WADADataTableCell"><?php echo $row_GetIDsForIms['prop_ref']; ?></td>
</tr>
</table>
<div class="WADAHorizLine"><img src="WA_DataAssist/images/_tx_.gif" alt="" height="1" width="1" border="0" /></div>
<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/Refined_insert.gif" /></td>
<td class="WADADataNavButtonCell" nowrap="nowrap"><a href="prop_images_Results.php" title="Cancel"><img border="0" name="Cancel" id="Cancel" alt="Cancel" src="WA_DataAssist/images/Pacifica/Refined_cancel.gif" /></a></td>
</tr>
</table>
<input name="WADAInsertRecordID" type="hidden" id="WADAInsertRecordID" value="" />
</div>
</form>
</div>
</body>
</html>
<?php
mysql_free_result($GetIDsForIms);
?>

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...