Code worked in PHP4 but not in PHP5 _Problem with SESSIONS
Posted: Thu Sep 22, 2005 2:53 pm
feyd | Please use
feyd | Please use
Code: Select all
andCode: Select all
tags where approriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]Code: Select all
<?php
session_start();
include("../dbconn2.php");
function sesreg($sesname)
{
if(!session_is_registered($sesname))
{
session_register($sesname);
}
}
function buildOption($name,$value)
{
$option="<option value=\"".$value."\">".$name."</option>";
echo $option;
}
sesreg("sortby");
sesreg("county");
sesreg("county2");
sesreg("orgfunction");
sesreg("visited");
sesreg("displayType");
if($_SESSION['visited']==""){
$_SESSION['visited'] = "n";
}
if($_POST['submit'] == "")
$_SESSION['submit'] = "n";
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link rel=stylesheet href="style.css" type="text/css">
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
.style2 {
font-family: Helvetica, sans-serif;
font-size: xx-small;
}
-->
</style>
</head>
<body bgcolor="#006666">
<table width="100%" height="100%" cellpadding="5" cellspacing="1">
<tr bgcolor="#CCFFCC">
<td height="113" colspan="3" bgcolor="#CCFFCC"><img src="fedbanner.gif" width="587" height="101" align="left"><a href="map.html"><img src="map.gif" title="Search by County" alt="Search by County" width="96" height="103" border="0" align="right"></a></td>
</tr>
<tr>
<td height="2" colspan="3">
<p><a class="menu" href="/fed_dir/index.php"> Home </a><a class="menu" href="resources.htm"> Resources </a><a class="menu" href="glossary.html"> Glossary
</a><a class="menu" href="mission.htm"> About Us </a><a class="menu"
target="_blank" href="http://www.clevelandfed.org/CommAffairs/FinancialLit/PDF/FinSurvey3.pdf"> Add Your Organization </a><a class="menu" href="disclaimer.htm"> Disclaimer </a></p></td>
</tr>
<?php
if($_SESSION['visited']=="n" || $_SESSION['visited']=="")
{
?>
<form action= "<?php echo $_SERVER['PHP_SELF'];?>" method="POST">
<?php
$query2=<<<Q2
select * from tbl_fed_counties ORDER BY counties;
Q2;
$res_x = pg_query($conn,$query2);
$rows = pg_num_rows($res_x);
//echo $rows;
$query3=<<<Q3
select * from tbl_fed_counties ORDER BY counties;
Q3;
$res_y = pg_query($conn,$query3);
$rows = pg_num_rows($res_y);
//echo $rows;
?>
<tr>
<td width="50%" rowspan="2" valign="top" bgcolor="#FFFFFF">
</td>
<td width="50%" colspan="2" align="left" valign="top" bgcolor="#FFFFFF">
<h2>Directory by type of Program:</h2>
<h3 class="main"><strong>Select a type of program from the following list: </strong></h3>
</p>
<h5 align="left" class="main"> Hold shift key for multiple choices:</h5>
<h5 align="left" class="main"><a href="programs.htm" class="main ">Type of Program </a><br>
<br>
<select name="orgfunction[]" size="4" multiple>
<?php
buildOption("Saving/Investing/Wealth Building","issaving");
buildOption("Credit/Budgeting","iscredit");
buildOption("Abusive Credit Practices/Predatory Lending Education","ispredatory");
buildOption("Financing a Major Purchase","isfinancing");
?>
</select>
<br>
<br>
Now select a county to see which organizations offer the program in
that area. <br>
<select name ="county2[]">
<?php
for($row=0;$row < $rows;$row++)
{
$resulty=pg_fetch_assoc($res_y);
buildOption($resulty['counties'],$resulty['county_id']);
}
?>
</select> </h5>
</tr>
<tr>
<td align="left" valign="top" bgcolor="#FFFFFF"><span class="main">
<input name="Submit" type="submit" value="Display by Program">
</span>
<td align="left" valign="top" bgcolor="#FFFFFF"><span class="main">
<input name="Submit" type="submit" value="Display by Organization">
</span>
</tr>
<tr align="center" valign="top" bgcolor="#FFFFFF">
<td height="2" colspan="3">
<div align="center">
</div></td>
</tr>
<?php
$_SESSION['visited']= 'y';
}
else
{
$_SESSION = $_POST;
header("Location: displayfed.php");
}
?>
</form>
</table>
</body>
</html>feyd | Please use
Code: Select all
andCode: Select all
tags where approriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]