|
-
Nov 25th, 2002, 02:33 PM
#1
Thread Starter
Lively Member
Simple PHP script help, please :)
I know this is a pretty simple question but this is all I want.
here goes, I want a script in php that if I put say:
www.myhost.com/myscript.php?character=1
it would come up with a page with info about character 1 (for a game site) but if I put :
www.myhost.com/myscript.php?character=2
it brings up a different page with info about character 2.
and so on.
Can anyone either make this script or send me somewhere that can tell me how to do it...
Thanks
-
Nov 25th, 2002, 04:14 PM
#2
Fanatic Member
PHP Code:
<?php
if $_REQUEST[character] == "1"){
print ("page1");
}
elseif $_REQUEST[character] == "2"){
print("page2");
}
else{
print("<a href=\"myscript.php?character=1\">Page 1</a><br>");
print("<a href=\"myscript.php?character=2\">Page 1</a><br>");
}
?>
There are many ways to do this, this is the simplist example I can think of.
-
Nov 26th, 2002, 10:01 AM
#3
Fanatic Member
PHP Code:
<?php
if (!isset($_REQUEST['character'])) $_REQUEST['character'] = "";
switch ($_REQUEST['character']) {
case 1:
// character 1 selected for viewing
break;
case 2:
// character 2 selected for viewing
break;
default:
// no character selected for viewing
}
?>
It is much easier if you have all the characters in a database b/c then you can just query the database for the information instead of outputting it by hand.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|