Okay… so I am loading some content into my page from the database… I know how to do this normally… but here is the sticking point… I want to load the content from one of 5 options (so there are multiple pages with 5 different options for body copy) depending on what the value of the cookie is…
Here is what I tried, but it did not work:
[php]//Determin which page ID to use in our query ----------------------------------------------------------------------------------------------
if (!$_GET[‘pid’]){
$pageid = ‘1’;
} else {
$pageid = $_GET[‘pid’];
}
//Query the Main Content and Titles for the proper page ---------------------------------------------------------------------------------------------
$sqlCommand=“SELECT process_mainContent_vers1, process_mainContent_vers2, process_mainContent_vers3, process_mainContent_vers4, process_mainContent_vers5, process_pagetitle FROM pages_process WHERE process_id=’$pageid’ LIMIT 1”;
$query=mysqli_query($myConnection, $sqlCommand) or die (mysql_error());
$body = ‘’;
$title = ‘’;
while ($row = mysqli_fetch_array($query))
{
if (isset($_COOKIE[‘career_status’]))
{
$carreerStatus = ($_COOKIE[‘career_status’]);
if ($carreerStatus=="Starting Residency/Graduating Medical School")
$body = $row["process_mainContent_vers1"];
if ($carreerStatus=="Ending Residency/Starting Fellowship")
$body = $row["process_mainContent_vers2"];
if ($carreerStatus=="Practicing Physician")
$body = $row["process_mainContent_vers3"];
if ($carreerStatus=="Practicing Physician")
$body = $row["process_mainContent_vers4"];
if ($carreerStatus=="Hospital/Practice Administrator")
$body = $row["process_mainContent_vers5"];
}
else
{
$carreerStatus = ($_SESSION['career_status']);
if ($carreerStatus=="Starting Residency/Graduating Medical School")
$body = $row["process_mainContent_vers1"];
if ($carreerStatus=="Ending Residency/Starting Fellowship")
$body = $row["process_mainContent_vers2"];
if ($carreerStatus=="Practicing Physician")
$body = $row["process_mainContent_vers3"];
if ($carreerStatus=="Practicing Physician")
$body = $row["process_mainContent_vers4"];
if ($carreerStatus=="Hospital/Practice Administrator")
$body = $row["process_mainContent_vers5"];
}
$title = $row["process_pagetitle"];
}
mysqli_free_result($query);
//-----------------------------------------------------------------------------------------------------------------------------------------
[/php]