Jump to content

[SOLVED] ?page=


jkewlo

Recommended Posts

i want it to look like www.blah.com/?page=index or when u click a link it would be www.blah.com/?page=login etc... instead of having the links show in the address bar like www.blah.com/index.php? or www.blah.com/login.php?

 

what would i do to make it like that i know i have to use the $_GET method to do it i just need a guide to show me

Link to comment
https://forums.phpfreaks.com/topic/75292-solved-page/#findComment-380788
Share on other sites

it could be .htaccess or it could just be a simple get function.

 

It could all be running off the index.php page which collects the get var and includes the correct file.

eg:

<a href="http://www.blah.com/?page=index">link</a>

then in blah.com/index.php:

require($_GET['page'] . '.php');

 

obviously this is a very simple example. You'll want some security on it.

Link to comment
https://forums.phpfreaks.com/topic/75292-solved-page/#findComment-380792
Share on other sites

no. What my example was doing was using the index,php, it was collecting the value of $_GET['page']. Then using 'require' to include another php page, where the filename was the value of $_GET['page'], with the added .php part at the end for the file extension.

 

So if you had a link like this:

<a href="http://www.mydomain.com/?page=info

Then this code:

require($_GET['page'] . '.php');

Would include the file http://www.mydomain.com/info.php

Link to comment
https://forums.phpfreaks.com/topic/75292-solved-page/#findComment-380798
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.