Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
How To Make Dynamic Pages With PHP
Old 12-09-2005, 06:15 PM How To Make Dynamic Pages With PHP
Junior Talker

Posts: 1
Trades: 0
Hi Everyone,

I'm trying to work out how to pass a variable from the url into the page content.

For example, if I type in http://www.mydomain.com/?id=apples then I can have the word "apples" anywhere on my page.

Is there some simple code I put into my index.php page to make this happen?

I'm new to this so sorry if I get the terminology wrong.

Thanks in advance,

Shola

Last edited by Shola; 12-09-2005 at 06:20 PM..
Shola is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 12-09-2005, 06:28 PM
0beron's Avatar
Defies a Status

Posts: 1,832
Location: Somewhere else entirely
Trades: 0
All the variables in the URL become available in an array called $_GET (since they are sometimes called 'get' variables). So in your index.php, you can write:

PHP Code:
<div>
HTML code here<br />
The value of the id variable was <?php echo $_GET['id']; ?> <br />
More HTML code here...
</div>
Then when you view the page, that little section of PHP code will be replaced with the contents of the id variable from the URL.
__________________
UPDATE 0beron SET talkupation = talkupation + lots WHERE post = 'helpful';

Please login or register to view this content. Registration is FREE
(aka MSN handwriting for forums)
0beron is offline
Reply With Quote
View Public Profile Visit 0beron's homepage!
 
Old 12-12-2005, 04:24 PM
Uche's Avatar
Extreme Talker

Posts: 174
Location: Nigeria/Lagos
Trades: 0
shola they answerd your reply
__________________
Life is just lyke a school where everybody goes to learn one or two thing. the more u school, the more u learn more about school..The more we live our lifes.. the more we learn more about life.

Please login or register to view this content. Registration is FREE
Uche is offline
Reply With Quote
View Public Profile Visit Uche's homepage!
 
Old 12-12-2005, 06:30 PM
Skilled Talker

Posts: 68
Trades: 0
Quote:
Originally Posted by Uche
shola they answerd your reply
what kind of a post is that,
also be careful when echoing user input or at least echo it within <xmp> </xmp> tags
mrpaul is offline
Reply With Quote
View Public Profile
 
Old 12-12-2005, 08:06 PM
Novice Talker

Posts: 5
Trades: 0
The good ol' days. I remember when I first started coding in PHP, (cough cough in 99'). Back then there weren't as many web development forums. IRC and phpbuilder was my main source of learning and those expensive books.

Forums make it lot easier to learn. Most of the time people are really friendly and helpful.

Good luck with learning the language, it's a fun language to code in!
nwelsh is offline
Reply With Quote
View Public Profile
 
Old 12-13-2005, 02:27 PM
0beron's Avatar
Defies a Status

Posts: 1,832
Location: Somewhere else entirely
Trades: 0
Quote:
Originally Posted by mrpaul
what kind of a post is that,
I think he was just bumping the thread so Shola wouldn't miss it....
__________________
UPDATE 0beron SET talkupation = talkupation + lots WHERE post = 'helpful';

Please login or register to view this content. Registration is FREE
(aka MSN handwriting for forums)
0beron is offline
Reply With Quote
View Public Profile Visit 0beron's homepage!
 
Old 12-13-2005, 05:05 PM
Ultra Talker

Posts: 264
Location: UK
Trades: 3
Quote:
Originally Posted by nwelsh
The good ol' days. I remember when I first started coding in PHP, (cough cough in 99'). Back then there weren't as many web development forums. IRC and phpbuilder was my main source of learning and those expensive books.

Forums make it lot easier to learn. Most of the time people are really friendly and helpful.

Good luck with learning the language, it's a fun language to code in!
Nothing wrong with phpbuilder
uktvindex is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to How To Make Dynamic Pages With PHP
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.43266 seconds with 12 queries