...

View Full Version : page content



Matt011
09-01-2007, 01:14 AM
heya all,

on my website i have a test.php page and link to test.php?test=1 and test.php?test=2


<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?

ess
09-01-2007, 10:35 AM
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.

mlseim
09-02-2007, 04:40 AM
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
$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.

rafiki
09-02-2007, 11:10 AM
$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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum