Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Aug 2006
    Thanked 0 Times in 0 Posts

    Help Needed on PHP

    I would like to have a page called something like site.php or site.html. Then, after that, I want to be able to do something like ?id=345 (www.mydomain.com/site.php?id=345) and go to a different page that ?id=235. (www.mydomain.com/site.php?id=235) How would I go about doing that? Can you possibly also give me a link to a tutorial telling me how to do that?

  • #2
    Master Coder
    Join Date
    Jun 2003
    Cottage Grove, Minnesota
    Thanked 1,096 Times in 1,087 Posts
    Your main page ( "index.php" )is:

    <head><title>main page</title></head>
    <a href='site.php?id=200'>Page 2</a><br />
    <a href='site.php?id=300'>Page 3</a><br />
    <a href='site.php?id=400'>Page 4</a><br />

    Here is your page called 'site.php' ...

    if($id == 200){$location="http://www.mysite.com/";}
    if($id == 300){$location="http://www.mysite2.com/";}
    if($id == 400){$location="http://www.mysite3.com/";}
    header ("location: $location");


    With that said, you should explain in more detail what your goal is ...

    there might be a better solution than what you're describing.

    You can give your webpage an extension of .php and do "PHP includes",
    and dynamic creation of pages ... mixing HTML and PHP in the same page.
    Using PHP for dynamically created pages is extremely powerful.


    Here's an example of what I'm talking about. By using PHP Includes, each
    page is dynamically generated by text files (the content). Notice that
    the pages are all the same URL with a different "page" variable assigned.
    That page variable determines which text file (HTML source) to include
    in the content.

    A working example of what I mean: http://www.palosantodesigns.com



    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts