Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4

Thread: page content

  1. #1
    New to the CF scene
    Join Date
    Aug 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    page content

    heya all,

    on my website i have a test.php page and link to test.php?test=1 and test.php?test=2
    Code:
         <a href="test.php?test=1">Test 1</a><br>
         <a href="test.php?test=2">Test 2</a><br>
    what javascript script do i need to tell it what to put on these 2 pages (?test=1 and ?test=2) and where to put the content i want to have on these pages.

    can someone please explain?

  • #2
    ess
    ess is offline
    Regular Coder
    Join Date
    Oct 2006
    Location
    United Kingdom
    Posts
    866
    Thanks
    7
    Thanked 30 Times in 29 Posts
    Hello Matt011
    first, please note that this section of the forum deals only with Java programming. Java and JavaScript are totally different programming languages.

    second, no idea as to what it is that you are after. please provide a code sample to explicate what it is that you need help with.

  • #3
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,538
    Thanks
    8
    Thanked 1,093 Times in 1,084 Posts
    Matt ...

    I think I know what you're trying to ask ...

    You want to grab the variables in the URL?

    This is the PHP script called "test.php" ...
    PHP Code:
    <?php
    $var1 
    $_GET['test'];
    echo 
    $var1;
    ?>
    <a href="test.php?test=1">Test 1</a><br>
    <a href="test.php?test=2">Test 2</a><br>
    In that little test example it will print either a 1 or a 2, depending
    on which link you click. It reads the variable called "test" and
    assigns that to $var1. Your script is actually calling itself, which
    is perfectly fine, but you didn't really elaborate on what you're
    doing.

  • #4
    Senior Coder rafiki's Avatar
    Join Date
    Aug 2006
    Location
    Floating around somewhere...
    Posts
    2,046
    Thanks
    19
    Thanked 42 Times in 42 Posts
    PHP Code:
    $foo = $_GET['test'];
    if ($foo == 1){
    include 'testpageone.php';
    }elseif($foo == 2){
    include 'testpagetwo.php';
    }else{
    ?>
    <a href="test.php?test=1">Test 1</a><br>
    <a href="test.php?test=2">Test 2</a><br>
    <?php
    }
    ?>
    is a better example for showing page content.


  •  

    Posting Permissions

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