php code
Hi
I was wondering what the php code would be for this particular control structure:
if (condition satisfied)
{ open one html page
}
else
{ open another html page
}
any ideas? is it possible?
thanks
Hi
I was wondering what the php code would be for this particular control structure:
if (condition satisfied)
{ open one html page
}
else
{ open another html page
}
any ideas? is it possible?
thanks
Busy posted this at 21:13 — 6th October 2005.
He has: 6,151 posts
Joined: May 2001
An IF ELSE is just that, "do this, IF is ok. ELSE do the other"
$today_is = 'weekend';
if ($today_is == 'weekday')
{
echo 'back to work';
}else{
echo 'woohooo it's the weekend, love these one day work weeks';
}
This is basic PHP, you should really have a read over the manual (php.net)
EarlDaniels posted this at 22:30 — 6th October 2005.
They have: 14 posts
Joined: Oct 2005
To do a regular redirect, the "open one html page" code might be something like:
header("Location: http://mydomain.com/mypage.html");
Remember that this command must be issued before ANY html is sent out (even blank lines!).
Tudor.b posted this at 08:40 — 9th October 2005.
They have: 35 posts
Joined: Jun 2004
Or simply use the include function
if (condition satisfied)
{
include ("/path/to/page");
}
else
{
include ("/path/to/the/other/page");
}
www.it-base.ro
subu posted this at 15:13 — 10th October 2005.
They have: 10 posts
Joined: Aug 2005
thanks...i'll try it out
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.