billhobbs Posted May 27, 2014 Share Posted May 27, 2014 I'm having an issue with holding a session variable in the statement below $Color is losing its value in the if statement. For example int the ( ) $Color is a zero while in the echo part $Color is being displayed correctly as Blue. Any ideas why in the same expression $Color would be Zero in one place while Blue in another? <?php $Color = $siteCart->DisplayInfo("Color"); ?> <?php if ($Color == '' || $Color == '0') echo ""; else echo "<p><strong>Color</strong> $Color </p>"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/288814-session-variable-losing-value-in-if-else-statement/ Share on other sites More sharing options...
Ch0cu3r Posted May 27, 2014 Share Posted May 27, 2014 A condition does not alter a variables value. How do you know that $Color is being changed to a zero? Your condition can be changed to <?php if (!empty($Color) || $Color != '0') echo "<p><strong>Color</strong> $Color </p>"; ?> Which will eliminate the need to have the else Quote Link to comment https://forums.phpfreaks.com/topic/288814-session-variable-losing-value-in-if-else-statement/#findComment-1481063 Share on other sites More sharing options...
billhobbs Posted May 27, 2014 Author Share Posted May 27, 2014 I tried your code and created a session variable for Color & Size. The echo always executes even if the $Color value is Blue. What I want is for $Color to show and $Size to not show since the value is empty. <?php $Color = "Blue" ?> <?php if (!empty($Color) || $Color != '0') echo "<p><strong>Color</strong> $Color </p>"; ?> <?php $Size = "" ?> <?php if (!empty($Size) || $Size != '0') echo "<p><strong>Size</strong> $Size </p>"; ?> Executed: Color Blue Size When it should only have been Color Blue I hope I'm making myself clear. Quote Link to comment https://forums.phpfreaks.com/topic/288814-session-variable-losing-value-in-if-else-statement/#findComment-1481064 Share on other sites More sharing options...
Ch0cu3r Posted May 27, 2014 Share Posted May 27, 2014 Remove the || $Size != '0' from the condition. Also note $Color and $Size are not session variables. They are just variables defined in the applications scope, once PHP has finished parsing the script they will not be remembered. If you want a variable to maintain its values across multiple pages you'll need to use sessions Quote Link to comment https://forums.phpfreaks.com/topic/288814-session-variable-losing-value-in-if-else-statement/#findComment-1481065 Share on other sites More sharing options...
billhobbs Posted May 27, 2014 Author Share Posted May 27, 2014 (edited) Maybe it will help if I use the actual script as it is in my test environment. Color is Blue While Size is empty. It is getting the values from a shopping cart. Color shows up just the way it should: Color Blue Where as Size is showing up as: Size It doesn't have a value so it's empty. The problem is the word Size shouldn't be there either. But it is. <?php $Color = $siteCart->DisplayInfo("Color") ?> <?php if (!empty($Color)) echo "<p><strong>Color</strong> $Color </p>"; ?> <?php $Size = $siteCart->DisplayInfo("Size") ?> <?php if (!empty($Size)) echo "<p><strong>Size</strong> $Size </p>"; ?> Edited May 27, 2014 by billhobbs Quote Link to comment https://forums.phpfreaks.com/topic/288814-session-variable-losing-value-in-if-else-statement/#findComment-1481068 Share on other sites More sharing options...
Ch0cu3r Posted May 27, 2014 Share Posted May 27, 2014 What is the output of <?php $Size = $siteCart->DisplayInfo("Size") var_dump($Size); ?> Quote Link to comment https://forums.phpfreaks.com/topic/288814-session-variable-losing-value-in-if-else-statement/#findComment-1481075 Share on other sites More sharing options...
billhobbs Posted May 27, 2014 Author Share Posted May 27, 2014 (edited) Color gives me: string(9) " Blue" Size gives me: string(5) " " Edited May 27, 2014 by billhobbs Quote Link to comment https://forums.phpfreaks.com/topic/288814-session-variable-losing-value-in-if-else-statement/#findComment-1481076 Share on other sites More sharing options...
Ch0cu3r Posted May 27, 2014 Share Posted May 27, 2014 Thats the problem the DisplayInfo method is returning a string value consisting of 5 white-space characters. This is causing empty() to return false, and so the Size is always being displayed. Why is that method returning that kind of value? Could we see the code for that method? For now a work around would be <?php if (trim($Size) != '') echo "<p><strong>Size</strong> $Size </p>"; ?> But ideally you want to change that method so it returns a boolean false or a null value if there is no value to be returned for Size Quote Link to comment https://forums.phpfreaks.com/topic/288814-session-variable-losing-value-in-if-else-statement/#findComment-1481078 Share on other sites More sharing options...
billhobbs Posted May 27, 2014 Author Share Posted May 27, 2014 (edited) Here is the full code. Your work-a-round worked. Thanks. <?php @session_start(); ?> <?php require_once('Connections/connSiteDB.php'); ?> <?php require_once('includes/datefunctions.inc'); ?> <?php require_once("WA_eCart/siteCart_PHP.php"); ?> <?php require_once("webassist/forms/persist.php"); ?> <?php $siteCart->GetContent(); ?> <?php if (!session_id()) session_start(); if(isset($_POST["siteCart_Update_100"])) { $_SESSION["PromoCode"] = "".((isset($_POST["txtPromoCode"]))?$_POST["txtPromoCode"]:"") .""; } ?> <?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; } } mysql_select_db($database_connSiteDB, $connSiteDB); $query_rsSiteInfo = "SELECT * FROM siteinfo"; $rsSiteInfo = mysql_query($query_rsSiteInfo, $connSiteDB) or die(mysql_error()); $row_rsSiteInfo = mysql_fetch_assoc($rsSiteInfo); $totalRows_rsSiteInfo = mysql_num_rows($rsSiteInfo); mysql_select_db($database_connSiteDB, $connSiteDB); $query_rsPage = "SELECT * FROM pages WHERE pageID = 18"; $rsPage = mysql_query($query_rsPage, $connSiteDB) or die(mysql_error()); $row_rsPage = mysql_fetch_assoc($rsPage); $totalRows_rsPage = mysql_num_rows($rsPage); mysql_select_db($database_connSiteDB, $connSiteDB); $query_rsFacebookComments = "SELECT * FROM siteinfo WHERE siteFacebookComments = 'Yes'"; $rsFacebookComments = mysql_query($query_rsFacebookComments, $connSiteDB) or die(mysql_error()); $row_rsFacebookComments = mysql_fetch_assoc($rsFacebookComments); $totalRows_rsFacebookComments = mysql_num_rows($rsFacebookComments); mysql_select_db($database_connSiteDB, $connSiteDB); $query_rsSocialMedia = "SELECT * FROM siteinfo WHERE siteSocialMedia = 'Yes'"; $rsSocialMedia = mysql_query($query_rsSocialMedia, $connSiteDB) or die(mysql_error()); $row_rsSocialMedia = mysql_fetch_assoc($rsSocialMedia); $totalRows_rsSocialMedia = mysql_num_rows($rsSocialMedia); mysql_select_db($database_connSiteDB, $connSiteDB); $query_rsSocialMediaLinks = "SELECT * FROM socialmedia WHERE socialActive = 'Yes'"; $rsSocialMediaLinks = mysql_query($query_rsSocialMediaLinks, $connSiteDB) or die(mysql_error()); $row_rsSocialMediaLinks = mysql_fetch_assoc($rsSocialMediaLinks); $totalRows_rsSocialMediaLinks = mysql_num_rows($rsSocialMediaLinks); mysql_select_db($database_connSiteDB, $connSiteDB); $query_rsStore = "SELECT * FROM store"; $rsStore = mysql_query($query_rsStore, $connSiteDB) or die(mysql_error()); $row_rsStore = mysql_fetch_assoc($rsStore); $totalRows_rsStore = mysql_num_rows($rsStore); $colname_rsPromo = "-1"; if (isset($_POST['txtPromoCode'])) { $colname_rsPromo = $_POST['txtPromoCode']; } mysql_select_db($database_connSiteDB, $connSiteDB); $query_rsPromo = sprintf("SELECT * FROM promocode WHERE promoCode = %s", GetSQLValueString($colname_rsPromo, "text")); $rsPromo = mysql_query($query_rsPromo, $connSiteDB) or die(mysql_error()); $row_rsPromo = mysql_fetch_assoc($rsPromo); $totalRows_rsPromo = mysql_num_rows($rsPromo); $colname_rsPromoAmount = "-1"; if (isset($_SESSION['PromoCode'])) { $colname_rsPromoAmount = $_SESSION['PromoCode']; } mysql_select_db($database_connSiteDB, $connSiteDB); $query_rsPromoAmount = sprintf("SELECT * FROM promocode WHERE promoCode = %s", GetSQLValueString($colname_rsPromoAmount, "text")); $rsPromoAmount = mysql_query($query_rsPromoAmount, $connSiteDB) or die(mysql_error()); $row_rsPromoAmount = mysql_fetch_assoc($rsPromoAmount); $totalRows_rsPromoAmount = mysql_num_rows($rsPromoAmount); mysql_select_db($database_connSiteDB, $connSiteDB); $query_rsOptionGroup1 = "SELECT * FROM optiongroups WHERE OptionGroupID = 1"; $rsOptionGroup1 = mysql_query($query_rsOptionGroup1, $connSiteDB) or die(mysql_error()); $row_rsOptionGroup1 = mysql_fetch_assoc($rsOptionGroup1); $totalRows_rsOptionGroup1 = mysql_num_rows($rsOptionGroup1); mysql_select_db($database_connSiteDB, $connSiteDB); $query_rsOptionGroup2 = "SELECT * FROM optiongroups WHERE OptionGroupID = 2"; $rsOptionGroup2 = mysql_query($query_rsOptionGroup2, $connSiteDB) or die(mysql_error()); $row_rsOptionGroup2 = mysql_fetch_assoc($rsOptionGroup2); $totalRows_rsOptionGroup2 = mysql_num_rows($rsOptionGroup2); mysql_select_db($database_connSiteDB, $connSiteDB); $query_rsOptionGroup3 = "SELECT * FROM optiongroups WHERE OptionGroupID = 3"; $rsOptionGroup3 = mysql_query($query_rsOptionGroup3, $connSiteDB) or die(mysql_error()); $row_rsOptionGroup3 = mysql_fetch_assoc($rsOptionGroup3); $totalRows_rsOptionGroup3 = mysql_num_rows($rsOptionGroup3); mysql_select_db($database_connSiteDB, $connSiteDB); $query_rsOptionGroup4 = "SELECT * FROM optiongroups WHERE OptionGroupID = 4"; $rsOptionGroup4 = mysql_query($query_rsOptionGroup4, $connSiteDB) or die(mysql_error()); $row_rsOptionGroup4 = mysql_fetch_assoc($rsOptionGroup4); $totalRows_rsOptionGroup4 = mysql_num_rows($rsOptionGroup4); mysql_select_db($database_connSiteDB, $connSiteDB); $query_rsOptionGroup5 = "SELECT * FROM optiongroups WHERE OptionGroupID = 5"; $rsOptionGroup5 = mysql_query($query_rsOptionGroup5, $connSiteDB) or die(mysql_error()); $row_rsOptionGroup5 = mysql_fetch_assoc($rsOptionGroup5); $totalRows_rsOptionGroup5 = mysql_num_rows($rsOptionGroup5); ?> <?php if (!session_id()) session_start(); if(isset($_POST["siteCart_Update_100"])) { $_SESSION["PromoAmount"] = "".$row_rsPromo['promoAmount'] .""; } ?> <?php if (!session_id()) session_start(); if(isset($_POST["siteCart_Update_100"])) { $_SESSION["PromoType"] = "".$row_rsPromo['promoType'] .""; } ?> <?php // WA eCart Update if (isset($_POST["siteCart_Update_100"]) || isset($_POST["siteCart_Update_100_x"])) { $siteCart->UpdateCart(); $Redirect_redirStr=""; if ($Redirect_redirStr != "") { $siteCart->redirStr = $Redirect_redirStr; } $siteCart->cartAction = "Update"; } ?> <?php // WA eCart Update if (isset($_POST["siteCart_Update_100"]) || isset($_POST["siteCart_Update_100_x"])) { $siteCart->CartUpdate(); $Redirect_redirStr=""; if ($Redirect_redirStr != "") { $siteCart->redirStr = $Redirect_redirStr; } $siteCart->cartAction = "Update"; } ?> <?php // WA eCart Continue Shopping if (isset($_POST["siteCart_Continue_100"]) || isset($_POST["siteCart_Continue_100_x"])) { $Redirect_redirStr=""; if (true && isset($_SESSION['WAEC_ContinueRedirect'])) { $Redirect_redirStr=siteToPageRel($_SESSION['WAEC_ContinueRedirect']); } if ($Redirect_redirStr != "") { $siteCart->redirStr = $Redirect_redirStr; } $siteCart->cartAction = "Continue"; } ?> <?php // WA eCart Clear Cart if (isset($_POST["siteCart_Clear_100"]) || isset($_POST["siteCart_Clear_100_x"])) { $siteCart->ClearCart(); $Redirect_redirStr=""; if ($Redirect_redirStr != "") { $siteCart->redirStr = $Redirect_redirStr; } $siteCart->cartAction = "ClearCart"; } ?> <?php //WA eCart Redirect Check Out if (isset($_POST["siteCart_Checkout"]) || isset($_POST["siteCart_Checkout_x"])) { $Redirect_redirStr="shop-login.php"; if ($Redirect_redirStr != "") { if (isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING'] != "") { if (strpos($Redirect_redirStr, "?") < 0) { $Redirect_redirStr .= "?".$_SERVER['QUERY_STRING']; } else { $Redirect_redirStr .= "&".$_SERVER['QUERY_STRING']; } } $siteCart->redirStr = $Redirect_redirStr; } $siteCart->cartAction = "Checkout"; } ?> <?php // WA eCart Redirect if ($siteCart->redirStr != "") { header("Location: ".$siteCart->redirStr); } ?> <!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"><!-- InstanceBegin template="/Templates/MainTemplate.dwt.php" codeOutsideHTMLIsLocked="false" --> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <!-- InstanceBeginEditable name="doctitle" --> <!-- InstanceEndEditable --> <title><?php echo $row_rsSiteInfo['siteName']; ?><?php $pagetitle = $row_rsPage['pageTitle']; ?><?php if ( $pagetitle == "") echo ""; else echo " - "; ?><?php echo $pagetitle; ?></title> <meta name="Description" content="<?php echo $row_rsSiteInfo['siteDescription']; ?>" /> <meta name="Keywords" content="<?php echo $row_rsSiteInfo['siteKeywords']; ?>" /> <?php echo $row_rsSiteInfo['siteGoogleAnalytics']; ?> <?php echo $row_rsSiteInfo['siteJavascript']; ?> <?php echo $row_rsSiteInfo['siteHeaderCode']; ?> <!-- InstanceBeginEditable name="head" --> <meta name="keywords" content="<?php echo $row_rsPage['pageKeywords']; ?>" /> <meta name="description" content="<?php echo $row_rsPage['pageDescription']; ?>" /> <link href="css/main.css" rel="stylesheet" type="text/css" /> <link href="css/menu.css" rel="stylesheet" type="text/css" /> <!-- InstanceEndEditable --> </head> <body><a name="top" id="top"></a> <table width="1000" align="center" cellpadding="0" cellspacing="0"> <tr> <td align="center" valign="bottom"><img src="images/<?php echo $row_rsPage['pageTop']; ?>" border="0" usemap="#Map" /></td> </tr> <tr> <td height="94" align="left" valign="top" background="images/<?php echo $row_rsPage['pageCenter']; ?>"><table width="973" align="center" cellpadding="0" cellspacing="0"> <tr> <td bgcolor="#EEEEEE"><?php include_once "menu/menu.html"; ?></td> </tr> <tr> <td><table width="100%" cellspacing="0" cellpadding="0"> <tr> <td align="center" valign="top"><table width="100%" cellspacing="15" cellpadding="0"> <tr> <td valign="top"><!-- InstanceBeginEditable name="BodyRegion" --> <!-- Start Social Media --> <?php if ($totalRows_rsSocialMedia > 0) { // Show if recordset not empty ?> <div class="socialtab"> <div class="tab"> <img alt="" src="images/Icons/ShareButton.png" width="35" height="125"/> </div> <div class="tabcontent"> <ul class="iconlist"> <?php do { ?> <li><a title="" href="<?php echo $row_rsSocialMediaLinks['socialLink']; ?>" target="<?php echo $row_rsSocialMediaLinks['socialTarget']; ?>"><img alt="" src="images/Icons/<?php echo $row_rsSocialMediaLinks['socialIcon']; ?>" width="38" /><span><?php echo $row_rsSocialMediaLinks['socialName']; ?></span></a></li> <?php } while ($row_rsSocialMediaLinks = mysql_fetch_assoc($rsSocialMediaLinks)); ?> </ul> </div> </div><?php } // Show if recordset not empty ?> <!-- End Social Media --> <table width="100%"> <tr> <td align="left" valign="top"> <!-- Get URL variable and make it a session variable for messages. --><?php echo $row_rsPage['pageCode']; ?> <div class="eCart_Arial"> <?php //WA eCart Show If Start if (!$siteCart->IsEmpty()) { ?> <div id="eC_Simple_Slate_Arial" class="eC_Display"> <form action="<?php echo ($_SERVER["PHP_SELF"].(isset($_SERVER["QUERY_STRING"])?"?".htmlentities($_SERVER["QUERY_STRING"]):""));?>" method="post" > <span class="h2">Your Shopping Cart</span> <table class="eC_ShoppingCartUpdateable" border="0" cellspacing="0" cellpadding="0"> <tr> <th colspan="2" >Product thumbnail</th> <th width="13%" class="eC_PriceItem">Price</th> <th width="19%" class="eC_FormItem">Quantity</th> <th width="18%" class="eC_FormItem">Remove</th> <th width="13%" class="eC_PriceItem">Total</th> </tr> <?php while (!$siteCart->EOF()) { ?> <tr class="eC_DataRow"> <td width="7%" class="eC_GroupColumn"><p id="siteCart_JSON_Display_Name_<?php echo $siteCart->DisplayInfo("WAUID"); ?>" class="eC_ItemName"><img src="productimages/<?php echo $siteCart->DisplayInfo("Thumbnail"); ?>" alt="Product thumbnail" class="eC_ProductThumb" /></p></td> <td width="30%" class="eC_GroupColumn"> <p id="siteCart_JSON_Display_Name_<?php echo $siteCart->DisplayInfo("WAUID"); ?>2" class="eC_ItemName"><?php echo $siteCart->DisplayInfo("Name"); ?></p> <p id="siteCart_JSON_Display_Description_<?php echo $siteCart->DisplayInfo("WAUID"); ?>2" class="eC_ItemDescription"><?php echo $siteCart->DisplayInfo("Description"); ?></p> <p><strong>SKU:</strong> <?php echo $siteCart->DisplayInfo("SKU"); ?></p> <p><?php echo $siteCart->DisplayInfo("Color"); ?> <?php echo $siteCart->DisplayInfo("Size"); ?> <?php echo $siteCart->DisplayInfo("UDO1"); ?> <?php echo $siteCart->DisplayInfo("UDO2"); ?> <?php echo $siteCart->DisplayInfo("UDO3"); ?></p> <?php $Color = ($siteCart->DisplayInfo("Color")) ?> <?php $Size = ($siteCart->DisplayInfo("Size")) ?> <?php $UDO1 = ($siteCart->DisplayInfo("UDO1")) ?> <?php $UDO2 = ($siteCart->DisplayInfo("UDO2")) ?> <?php $UDO3 = ($siteCart->DisplayInfo("UDO3")) ?> <?php if (trim($Color) != '') echo "<p><strong>Color:</strong> $Size </p>"; ?> <?php if (trim($Size) != '') echo "<p><strong>Size:</strong> $Size </p>"; ?> <?php if (trim($UDO1) != '') echo "<p><strong>UDO1:</strong> $UDO1 </p>"; ?> <?php if (trim($UDO2) != '') echo "<p><strong>UDO2:</strong> $UDO2 </p>"; ?> <?php if (trim($UDO3) != '') echo "<p><strong>UDO3:</strong> $UDO3 </p>"; ?> </td> <td class="eC_PriceItem" id="siteCart_JSON_Display_Price_<?php echo $siteCart->DisplayInfo("WAUID"); ?>"><?php echo WA_eCart_DisplayMoney($siteCart, $siteCart->DisplayInfo("TruePrice")); ?></td> <td class="eC_FormItem"><input type="text" id="siteCart_Quantity_<?php echo $siteCart->DisplayInfo("WAUID"); ?>" name="siteCart_Quantity_<?php echo $siteCart->DisplayInfo("WAUID"); ?>" size="3" value="<?php echo $siteCart->DisplayInfo("Quantity"); ?>" onkeypress="waec_showUpdate('siteCart_Update_Quantity_<?php echo $siteCart->DisplayInfo("WAUID"); ?>',this);" /></td> <td class="eC_FormItem"><input type="checkbox" value="<?php echo $siteCart->DisplayInfo("ID"); ?>" name="siteCart_Delete_<?php echo $siteCart->DisplayInfo("WAUID"); ?>" /></td> <td class="eC_PriceItem" id="siteCart_JSON_Display_TotalPrice_<?php echo $siteCart->DisplayInfo("WAUID"); ?>"><?php echo WA_eCart_DisplayMoney($siteCart, $siteCart->DisplayInfo("TotalPrice")); ?></td> </tr> <?php $siteCart->MoveNext(); } $siteCart->MoveFirst(); ?> </table> <table class="eC_ButtonWrapper" cellpadding="0" cellspacing="0"> <tr> <td><span class="BodyText"><strong>Promo Code*:</strong></span> <input name="txtPromoCode" type="text" class="FormBkgd" id="txtPromoCode" value="<?php echo $_SESSION['PromoCode']; ?>" size="10" /> <input type="submit" name="siteCart_Update_100" id="siteCart_Update_100" value="Apply Code" class="Button" /><input type="submit" name="siteCart_Continue_100" id="siteCart_Continue_100" value="Continue Shopping" class="Button" /> <input type="submit" name="siteCart_Clear_100" id="siteCart_Clear_100" value="Clear Cart" class="Button" /> <input type="submit" name="siteCart_Update_100" id="siteCart_Update_100" value="Update" class="Button" /></td> </tr> </table> <span class="h2">Order Summary</span> <div class="eC_OrderSummary"> <table border="0" cellpadding="0" cellspacing="0" class="eC_CartSummary"> <?php //WA eCart Merchandizing Show Start //ecart="siteCart" if ($siteCart->GetDiscounts() > 0 || $siteCart->GetCharges() > 0 || $siteCart->GetShipping() > 0 || $siteCart->GetTax() > 0) { ?> <tr> <td class="eC_SummaryLabel">Subtotal</td> <td id="siteCart_JSON_Display_SubTotal"><?php echo WA_eCart_DisplayMoney($siteCart, $siteCart->TotalColumn("TotalPrice")); ?></td> </tr> <?php //WA eCart Merchandizing Show End //ecart="siteCart" } ?> <?php //WA eCart Merchandizing Show Start //ecart="siteCart" if ($siteCart->GetDiscounts() > 0) { ?> <tr> <td class="eC_SummaryLabel">Discounts</td> <td id="siteCart_JSON_Display_@@ChargeNameType@@">-<?php echo WA_eCart_DisplayMoney($siteCart, $siteCart->GetDiscounts()); ?></td> </tr> <?php //WA eCart Merchandizing Show End //ecart="siteCart" } ?> <?php //WA eCart Merchandizing Show Start //ecart="siteCart" if ($siteCart->GetCharges() > 0) { ?> <tr> <td class="eC_SummaryLabel">Charges</td> <td id="siteCart_JSON_Display_@@ChargeNameType@@"><?php echo WA_eCart_DisplayMoney($siteCart, $siteCart->GetCharges()); ?></td> </tr> <?php //WA eCart Merchandizing Show End //ecart="siteCart" } ?> <?php //WA eCart Merchandizing Show Start //ecart="siteCart" if ($siteCart->GetShipping() > 0) { ?> <tr> <td class="eC_SummaryLabel">Shipping</td> <td id="siteCart_JSON_Display_@@ChargeNameType@@"><?php echo WA_eCart_DisplayMoney($siteCart, $siteCart->GetShipping()); ?></td> </tr> <?php //WA eCart Merchandizing Show End //ecart="siteCart" } ?> <?php //WA eCart Merchandizing Show Start //ecart="siteCart" if ($siteCart->GetTax() > 0) { ?> <tr> <td class="eC_SummaryLabel">Tax</td> <td id="siteCart_JSON_Display_@@ChargeNameType@@"><?php echo WA_eCart_DisplayMoney($siteCart, $siteCart->GetTax()); ?></td> </tr> <?php //WA eCart Merchandizing Show End //ecart="siteCart" } ?> <tr class="eC_SummaryFooter"> <td class="eC_SummaryLabel">Grand Total:</td> <td id="siteCart_JSON_Display_GrandTotal"><?php echo WA_eCart_DisplayMoney($siteCart, $siteCart->GrandTotal()); ?></td> </tr> <tr class="eC_ButtonWrapper"> <td> </td> <td><input type="submit" name="siteCart_Checkout" id="siteCart_Checkout" value="Checkout" class="CheckoutButton" /></td> </tr> </table> </div> </form> </div> <?php //WA eCart Show If Middle } else { ?> <?php //WA eCart Show If End } ?> <table id="eC_Simple_Slate_Arial_Empty" style="<?php echo(!$siteCart->IsEmpty()?'display:none;':''); ?>"> <tr> <td class="BodyText">The cart is empty</td> </tr> </table> </div> <br /> </td> </tr> </table> <?php if ($totalRows_rsAdsOnOff > 0) { // Show if recordset not empty ?> <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td align="center"><?php include("adshorizontal.php"); ?></td> </tr> </table> <?php } // Show if recordset not empty ?> <script> var ecart_json = "WA_eCart/eCart1_JSON.php"; </script> <script src="WA_eCart/js/eC_Display.js"></script> <!-- InstanceEndEditable --></td> </tr> </table></td> </tr> </table></td> </tr> </table></td> </tr> <tr> <td align="center" valign="top"><img src="images/<?php echo $row_rsPage['pageBottom']; ?>" /></td> </tr> <tr> <td align="center" valign="top"><?php include("footer.php"); ?></td> </tr> </table> <map name="Map" id="Map"><area shape="rect" coords="42,40,385,126" href="index.html" /> </map></body> <!-- InstanceEnd --></html> <?php mysql_free_result($rsSiteInfo); mysql_free_result($rsPage); mysql_free_result($rsFacebookComments); mysql_free_result($rsSocialMedia); mysql_free_result($rsSocialMediaLinks); mysql_free_result($rsStore); mysql_free_result($rsPromo); mysql_free_result($rsPromoAmount); mysql_free_result($rsOptionGroup1); ?> Edited May 27, 2014 by billhobbs Quote Link to comment https://forums.phpfreaks.com/topic/288814-session-variable-losing-value-in-if-else-statement/#findComment-1481081 Share on other sites More sharing options...
Ch0cu3r Posted May 27, 2014 Share Posted May 27, 2014 On second thoughts we'll leave it there. I aint digging through Dreamweaver spaghetti code. Quote Link to comment https://forums.phpfreaks.com/topic/288814-session-variable-losing-value-in-if-else-statement/#findComment-1481084 Share on other sites More sharing options...
billhobbs Posted May 27, 2014 Author Share Posted May 27, 2014 I totally understand. Thanks for the work around it should work for my needs. Quote Link to comment https://forums.phpfreaks.com/topic/288814-session-variable-losing-value-in-if-else-statement/#findComment-1481086 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.