Else if statements help -total newbie with a simple question
Posted: Thu Feb 12, 2009 5:34 am
Hi i need some help with an Else If statement. Basically I want to display some include text depending on where the user is i.e.
I want to pull in seo text for my homepages, using simple php includes, so index.php would pull in homepage_seo.php, aboutus.php would pull in aboutus_seo.php etc.
No i know that the statement has to be something like below, but I'm new to php, so any help would be great.
From W3 schools:
if (condition)
code to be executed if condition is true;
elseif (condition)
code to be executed if condition is true;
else
code to be executed if condition is false;
<?php
$d=date("D");
if ($d=="Fri")
echo "Have a nice weekend!";
elseif ($d=="Sun")
echo "Have a nice Sunday!";
else
echo "Have a nice day!";
?>
Thanks in advance,
Tony
I want to pull in seo text for my homepages, using simple php includes, so index.php would pull in homepage_seo.php, aboutus.php would pull in aboutus_seo.php etc.
No i know that the statement has to be something like below, but I'm new to php, so any help would be great.
From W3 schools:
if (condition)
code to be executed if condition is true;
elseif (condition)
code to be executed if condition is true;
else
code to be executed if condition is false;
<?php
$d=date("D");
if ($d=="Fri")
echo "Have a nice weekend!";
elseif ($d=="Sun")
echo "Have a nice Sunday!";
else
echo "Have a nice day!";
?>
Thanks in advance,
Tony