By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,985 Members | 1,712 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,985 IT Pros & Developers. It's quick & easy.

How to create page parameter?

P: 23
Hello all..

This is very simple question I think. :)
How to create multiple page navigation?
e.g:
- index.php?page=home
- index.php?page=download
- index.php?page=contact

Thank you very very much..

and Merry Christmas!
Dec 23 '07 #1
Share this Question
Share on Google+
5 Replies


realin
100+
P: 254
Hello all..

This is very simple question I think. :)
How to create multiple page navigation?
e.g:
- index.php?page=home
- index.php?page=download
- index.php?page=contact

Thank you very very much..

and Merry Christmas!

hi frozenade,

You can do it using simple switch-case.
an example would be ::

[PHP]

<?php
if($_GET){
$action=$_GET['page']
}

switch($action){

case 'download':

//your code stuff goes here
break;

case 'contact':

//your contact code goes here
break;

default:
//this you can use for home option

} //switch ends here

?>

[/PHP]

cheers !!
Dec 23 '07 #2

P: 23
hi..
it works. thank you very very much.. :)

one more question please, I hope you dont mind. :)
if 'default' use to 'home' page, how to set if user type wrong paremeter then it will show the custom error 404 msg?


thank you in advance.
Dec 24 '07 #3

realin
100+
P: 254
hi..
it works. thank you very very much.. :)

one more question please, I hope you dont mind. :)
if 'default' use to 'home' page, how to set if user type wrong paremeter then it will show the custom error 404 msg?


thank you in advance.
it is not mandatory that you put homepage's content into defualt, its just as i thought.. cause either way user is entering a wrong parameter, meaning he is trying be smart.. LOG HIS IP 5-7 times and then put a temp ban .. otherwise u can always show HOME page.. why we need to show 404 error page.. rest it all depends on ur design and technique u using ;)

cheers !!
Dec 24 '07 #4

P: 23
oh, I see now..
404 msg isn't necessary, cause wrong parameter will bring to default.

thank you very much. :)

Merry Christmas!
Dec 25 '07 #5

realin
100+
P: 254
oh, I see now..
404 msg isn't necessary, cause wrong parameter will bring to default.

thank you very much. :)

Merry Christmas!
anytime dude,
merry xmas :)
Dec 25 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.