i'm a web designer, but my skills are all in graphics and some css. I'm trying to get into the PHP world, and when trying to write a simple code, i'm already having problems.
The funny thing is, the script runs FINE when i comment out the function. whenever i make the if/else code into the function check_link(), and then echo the check_link() function, it just shoots automatically to the "else" part of the validator. WHY?!?!?
THANKS!
Code: Select all
<?php
$page_id= 'test1';
$id_current= 'test2';
$id_active= 'test3"';
function check_link()
{
if($page_id == 'test1')
{
echo $id_current;
}
elseif($page_id == 'test2')
{
echo $id_active;
}
else
{
echo "everything else";
}
}
echo check_link();
?>