Login

Login

Need to register? Lost password?

Options

Advertisements

Advertisements

 

PHP Help

WebDev

Minitokyo » Forum » Computers & Internet Fora » WebDev  PHP Help

page 1 of 1

Would anyone know how to make one of your pages/link to be like this:
Instead of having a page mysite.com/credits.php, I want it to mysite.com/index.php?credits

I'm not really sure what it's called, but I hope you know what I am talking about. I'd appreciate all the help! :sweat:
Thank you!

well.. i'm not a PHP coder (i'm a ColdFusion coder) but, the logic is the same...

well.. up there in the querystring (?something) you'll pass a value that will identify the page you wanna load.... so, you'll have to put some IFs (i recommend you to use SWITCH/CASE) and then include the page... like

(this is not the correct php syntax, just logical stuff)

SWITCH 'value':
CASE value = 'credits' {include credits.php};
CASE value = 'news' {include news.php};

or you may use IF/ELSE

IF (value = 'credits') then (include credits.php)
ELSE IF (value = 'news') then (include news.php)
ELSE IF (value = 'archive') then (include archive.php)

got the idea?

if(isset($_GET['parameter'])){
$lawl=$_GET['parameter'].'.php';
@include('dir/'.$lawl); or echo a meta HTML redirector if u prefer
}

a link would be: <a href="index.php?parameter=credits">

I hope it helps. Although I don't know how old this thread is xD

page 1 of 1

Only members can post replies, please register.