所以我试图将Session饼干和数组一起工作,并在我已经开始工作的流程页面中工作;我可以使用会话变量进行索引,它将显示数据库中的字符串。但是我在尝试在表格中显示它时遇到问题;
它也会抓取类型,因为我正在使用保存标识符的get方法。这部分很好。
我的问题是我的代码,我得到了未定义的错误,我不完全确定如何去做。任何帮助将不胜感激
if($type =="search"){
echo $searchForm;
}else if($type == "searchResult"){
?>
<div id="Table">
<table>
<tr>
<td>Name</td>
<td>Phone</td>
<td>Email</td>
<td>Department (if applicable)</td>
<td>Industry(If applicable)</td>
<td>Place Type</td>
<td>Image</td>
<td>Description</td>
<td>Organisation Website</td>
<td>Address</td>
</tr>
<?php
//This works
echo "This is the name variable output ".$_SESSION['sName'][1];
$searchTable = "
<tr>
<td>{$_SESSION['sName'][$var]}</td>
<td>{$_SESSION['sPhone'][$var]}</td>
<td>{$_SESSION['sEmail'][$var]}</td>
<td>{$_SESSION['sDepartment'][$var]}</td>
<td>{$_SESSION['sIndustry'][$var]}</td>
<td>{$_SESSION['sPlaceType'][$var]}</td>
<td><a href='{$_SESSION['sMapURL'][$var]}'>Map Link</a>'</td>
<td>{$_SESSION['sDescription'][$var]}</td>
<td>{$_SESSION['sOrganisationURL'][$var]}</td>
<td>{$_SESSION['sStNumber'][$var]} {$_SESSION['sStName'][$var]} {$_SESSION['sStType'][$var]} {$_SESSION['sPostcode'][$var]}</td>
</tr>";
for ($var = 0; $var <= $_SESSION['numRowsSearch']; $var++) {
echo $searchTable;
}
?>
</table>
</div>
<?php
}
?>