wraping code that inludes SESSIONS in a function
Posted: Thu Mar 20, 2003 7:56 am
Hi
I have written code that works fine that I would now like to wrap into a function. Inside the function i have added the line
Can anyone see what I am missing. The fact it works outside of the function I take it must be something simple I've missed. Thanks for any help you may be able to give.
Deej
I have written code that works fine that I would now like to wrap into a function. Inside the function i have added the line
the whole function now looks like thisglobal $HTTP_SESSION_VARS;
Code: Select all
<?php
function adDisplay()
{
global $HTTP_SESSION_VARS;
$business_group = $_SESSION['business_group'];
if($business_group == "retail"){ //open local
echo '<center><img src="../images/indexPageAds/retailStoreMemoCam.gif" width="135" height="178"></center> ';
} //close local
elseif($business_group == "office"){ //open local
echo '<center><img src="../../images/indexPageAds/officeMemoCam.gif"></center>';
} //close local
elseif($business_group == "warehouse_factory"){ //open local
echo '<center><img src="../../images/indexPageAds/warehouseFactory.gif"></center>';
} //close local
elseif($business_group == "school"){ //open local
echo '<center><img src="../../images/indexPageAds/schoolsMemoCam.gif"></center>';
} //close local
elseif($business_group == "hospital"){ //open local
echo '<center><img src="../../images/indexPageAds/hospitalsMemoCam.gif"></center>';
} //close local
elseif($business_group == "night_club"){ //open local
echo '<center><img src="../../images/indexPageAds/nightclubHHMDs.gif"></center>';
} //close local
elseif($business_group == "taxis_delivery_vehicles"){ //open local
echo '<center><img src="../../images/indexPageAds/deliveryVehicles.gif"></center>';
} //close local
elseif($business_group == "vending_machines"){ //open local
echo '<center><img src="../../images/indexPageAds/vendingMachinesMemoCam.gif"></center>';
} // close local
else //open local
echo '';
}
?>Deej