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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.