coldwerturkey;10910551 wrote:you would put it in an if statment and check it with the isset() or empty() function depending on how the url is (if it's .php?name= than use empty(), if it's not in the url like .php? than use isset())
if (!empty($_GET['name'])) {
$name = $_GET['name'];
} else { //not set (empty)
$name = 'Friend';
}
a better way to write it would be,
$name = (!empty($_GET['name'])) ? $_GET['name'] : 'Friend';
Dear coldwerturkey... I know it's been a couple of months, but we finally got back into this project again. Needless to say, I tried your code in many different ways and nothing worked - I'm sure I'm doing something wrong =(
But basically, here's the landing page for an herbal ingredient used to treat anxiety and depression:
http://www.hflsolutions.com/natural_remedies/anxiety_depression/st_johns_wort.php
I'm currently using: <?php echo $_GET["cat"]; ?> ... as "cat" = a category name. Therefore:
http://www.hflsolutions.com/natural_remedies/anxiety_depression/st_johns_wort.php?cat=Depression and then the headline changes to:
St. John's Wort: Natural Uses for Depression
or
LINK: http://www.hflsolutions.com/natural_remedies/anxiety_depression/st_johns_wort.php?cat=Anxiety
HEADLINE: St. John's Wort: Natural Uses for Depression
If there is no ?cat= and hence, it's just the URL of st_johns_wort.php, then I would like the headline to NOT be empty as it is now, but to have a generic "insert" of:
St. John's Wort: Natural Uses for Depression and Anxiety
... but unfortunately, none of the codes I've used that you gave me, changed, modified, etc work correctly and I know it's something I've done wrong =(
Any suggestions?
Thank you!