Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Closed Thread
Old 08-06-2008, 10:42 AM   #1 (permalink)
 
Newb Techie

Join Date: Jul 2008

Posts: 9

Hatter Madigan is on a distinguished road

Default Php Ids

I am a complete php novice. So, when you click a link on, say, tutorial.php, and you go to turtorial.php?id=something.

How do you do this?
Hatter Madigan is offline  
Old 08-06-2008, 05:26 PM   #2 (permalink)
CrazeD's Avatar
 
Wizard Techie

Join Date: Feb 2006

Location: Maine

Posts: 3,683

CrazeD will become famous soon enough

Send a message via AIM to CrazeD Send a message via MSN to CrazeD
Default Re: Php Ids

It's a query string URL. You use the $_GET super-global to use it.

tutorial.php
PHP Code:
<?php

$id 
$_GET['id'];

if (
$id == '1') {
    echo 
'This is tutorial 1';
} else if (
$id == '2') {
    echo 
'This is tutorial 2';
}

?>
tutorial.php?id=1 will echo "This is tutorial 1", and tutorial.php?id=2 will echo "This is tutorial 2".

That's obviously a stupid way to do it, unless you want static results. Normally you would do this with a database or other dynamic means.
__________________

Need website help? PM me!
CrazeD is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Removing PHP For Increased Download Speed Rex100 Programming Discussions 4 07-21-2008 03:49 PM
Calling all PHP and MySql experts murdocsvan Programming Discussions 4 04-17-2008 01:51 PM
PHP Coding Pat_pet Programming Discussions 8 03-26-2008 06:41 AM
PHP request not responding Bengal313 Programming Discussions 3 02-13-2008 06:39 PM
Remote file access w/ IP + PHP? thejeremy Programming Discussions 2 04-04-2007 05:24 PM