943,640 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 3215
  • PHP RSS
Jul 28th, 2004
0

Simple (I think) Code Question

Expand Post »
Can anyone tell me how I would code links to other pages on my site (using php) whereby the full URL in the address bar looks like this:

http://www.mysite.com/index.php?id=3 (which points to blah.php)

I've done the usual searches on google and such with no luck on how to do it.

Mind you, I'm *not* a coder/webmaster so if you start talking about arrays and such, I'll have no idea what you're talking about :)
Similar Threads
Reputation Points: 128
Solved Threads: 8
Posting Whiz
TheOgre is offline Offline
390 posts
since Aug 2003
Jul 30th, 2004
0

Re: Simple (I think) Code Question

I assume you want to redirect from http://www.mysite.com/index.php?id=3 to http://www.anothersite.com/blah.php

You can use header() function to do it.

If not, post here again.
PoA
Reputation Points: 19
Solved Threads: 9
Posting Whiz in Training
PoA is offline Offline
234 posts
since Jul 2004
Jul 31st, 2004
0

Re: Simple (I think) Code Question

No, what I want to do is hide the actual page link, so the URL reads:

http://www.mysite.com/index.php?id=2

instead of:

http://www.mysite.com/iwanttohidethispage.html

No redirection to another domain, just hiding the actual pages from showing up in the location bar of the browser. For an example, please see http://www.cacert.org
Reputation Points: 128
Solved Threads: 8
Posting Whiz
TheOgre is offline Offline
390 posts
since Aug 2003
Jul 31st, 2004
0

Re: Simple (I think) Code Question

Well, it's mod_rewrite. You can check out at http://www.mod-rewrite.com/forum/thread10.html
PoA
Reputation Points: 19
Solved Threads: 9
Posting Whiz in Training
PoA is offline Offline
234 posts
since Jul 2004
Aug 4th, 2004
0

Re: Simple (I think) Code Question

hmm. sounds to me like a simple include, but that's probably inefficient.

[PHP]
<?php

$pages = "/path/to/pages/";
$default = 1;

if(is_file($pages.$_GET['id'].".php")) $p = $_GET['id'];
else $p = $default;

include $pages.$p.".php";
?>
[/PHP]

Just have all your pages as ID numbers.. IE: news page = 3.html

But that's really inefficient, and probably not how you do it =P
Reputation Points: 10
Solved Threads: 0
Newbie Poster
kenleycapps is offline Offline
9 posts
since Aug 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Zend PHP Certification
Next Thread in PHP Forum Timeline: Error when editing PHP lines in a theme file.





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC