PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Okay, im designing a webpage which has some links at the top that go to different parts of the page. One link would goto Index.php?p=News and one to Index.php?p=Join Ill be adding more but this is all i need for right now. Here is my code:
But this is giving me an error.. What am i doing wrong with the if statements? And also, this PHP is placed in the middle of an HTML document where the text is suppost to show up, is that okay to do?
<?php
// NEED TO ADD SEMICOLON AND QUOTES
$p = 'News';
// NEED TO PUT QUOTES AROUND THIS
if($p == 'News') {
echo "NEWS";
} else {
}
// NEED QUOTES HERE TOO
if($p == 'Join') {
echo "JOIN";
} else {
}
?>
try that
also you dont need all those else statments if you're keeping them empty
Last edited by JPlush76 on Tue May 20, 2003 1:01 pm, edited 1 time in total.
<?php
// of course if you set $p to News then it can't possibly be Join
$p = 'News';
if($p == 'News') {
echo 'NEWS';
} elseif ($p == 'Join') {
echo 'JOIN';
}
?>