Jump to content

Getting unique page title from query... some variables not showing?


easyedy

Recommended Posts

Hi. I'm trying to call a unique page title from a query but some variables aren't showing and I'm wondering if I'm missing a step or coding it wrong...

 

Here is my code that works and will display the title correctly with this URL:

 

store.php?brand=adidas&category=golf&subcategory=shirts

 

if(isset($_GET['brand']) & isset($_GET['category']) & isset($_GET['subcategory']))
{
$pagetitle = $_GET['brand'] . " " . $_GET['subcategory'];
}  

elseif(isset($_GET['brand']) & isset($_GET['category']))
{
$pagetitle = $_GET['brand'] . " " . $_GET['category'];
} 

elseif(isset($_GET['brand']))
{
$pagetitle = $_GET['brand'];
} 

else {
$pagetitle = "Universal page title";
}

 

But our store has a few feature to display price range ($100-$200) and sale items range (40% off) so I added 2 more if statements for price and clearance and it wont the sale from this URL:

 

store.php?brand=adidas&category=golf&subcategory=shirts&sale=3

 

if(isset($_GET['brand']) & isset($_GET['category']) & isset($_GET['subcategory']) & isset($_GET['sale']))
{
$pagetitle = $_GET['brand'] . " " . $_GET['subcategory']. " " . $_GET['sale'];
}  

elseif(isset($_GET['brand']) & isset($_GET['category']) & isset($_GET['subcategory']))
{
$pagetitle = $_GET['brand'] . " " . $_GET['subcategory'];
}  

elseif(isset($_GET['brand']) & isset($_GET['category']))
{
$pagetitle = $_GET['brand'] . " " . $_GET['category'];
} 

elseif(isset($_GET['brand']))
{
$pagetitle = $_GET['brand'];
} 


else {
$pagetitle = "Universal page title";
}

 

 

I've tried everything... changing if statements.. redoing variables... etc. The sale and price variables are conditionals ie 1=10% off, 2=20%off etc would that have anything to do with it?

 

thanks.

 

Edy

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.