upshire Posted January 15, 2013 Share Posted January 15, 2013 Hi I 'm using Dreamweaver CS6,My SQL and Php... I am displaying a list of companies from a recordset on companies.php, then I place a link on the company id which takes me to company_details.php which displays that companies details, the recordset is filterd by a session variable 'vartest'. This works fine until I place the results on companies.php in to a repeat region, when I do this, the value of the session variable 'comp_id' remains equal to the id of the first record in the recordset no matter which record is clicked on. How do I populate the session 'vartest' with the selected $rows id. Any and all help appreciated.. David P.S I have posted the code of the page in question, showing the Dreamweaver recordset and the repeat region applied. <?php require_once('Connections/connpay.php'); ?> <?php session_start();?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $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; } } $maxRows_rstest = 10; $pageNum_rstest = 0; if (isset($_GET['pageNum_rstest'])) { $pageNum_rstest = $_GET['pageNum_rstest']; } $startRow_rstest = $pageNum_rstest * $maxRows_rstest; mysql_select_db($database_connpay, $connpay); $query_rstest = "SELECT * FROM db_company"; $query_limit_rstest = sprintf("%s LIMIT %d, %d", $query_rstest, $startRow_rstest, $maxRows_rstest); $rstest = mysql_query($query_limit_rstest, $connpay) or die(mysql_error()); $row_rstest = mysql_fetch_assoc($rstest); if (isset($_GET['totalRows_rstest'])) { $totalRows_rstest = $_GET['totalRows_rstest']; } else { $all_rstest = mysql_query($query_rstest); $totalRows_rstest = mysql_num_rows($all_rstest); } $totalPages_rstest = ceil($totalRows_rstest/$maxRows_rstest)-1; ?> <!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>Untitled Document</title> </head> <body> <?php do { ?> <a href="test_result.php?<?php echo $_SESSION['vartest']; ?>=<?php echo $row_rstest['company_id']; ?>"><?php echo $row_rstest['company_id']; ?></a> <?php } while ($row_rstest = mysql_fetch_assoc($rstest)); ?> </body> </html> <?php mysql_free_result($rstest); ?> Quote Link to comment https://forums.phpfreaks.com/topic/273182-passing-session-variable-from-dreamweaver-repeat-region/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.