943,754 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 826
  • PHP RSS
Nov 24th, 2008
0

PHP extension querie! .php?id=2

Expand Post »
Hi all I am a beginner with mark up and am trying my hand at HTML, Javascript and PHP. Currently I am copying source code from sites so I can learn and understand the code and rebuild the sites with my own content.

Just recently I came across a site and within the mark up of the page 'works.php' it gives me this href

PHP Syntax (Toggle Plain Text)
  1. <li><a href="javascript:getWork(1)">Works 1</a></li>

which tells the page to go get the URL

http://www.leandroerlich.com/works.php?id=2

what I'm finding hard to grasp is the extension onto the usual .php convention

works.php?id=2

what is "?id=2" ??

I understand that this maybe also a javascript question so I apologise if I am writing this thread in the wrong place.

If anyone can help me I would be very greatful

blunt
Last edited by peter_budo; Nov 24th, 2008 at 6:33 pm. Reason: Code tags in wrong place
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
blunt57 is offline Offline
1 posts
since Nov 2008
Nov 24th, 2008
0

Re: PHP extension querie! .php?id=2

Click to Expand / Collapse  Quote originally posted by blunt57 ...
PHP Syntax (Toggle Plain Text)
  1. Hi all I am a beginner with mark up and am trying my hand at HTML, Javascript and PHP. Currently I am copying source code from sites so I can learn and understand the code and rebuild the sites with my own content.
  2.  
  3. Just recently I came across a site and within the mark up of the page 'works.php' it gives me this href
  4.  
  5. <li><a href="javascript:getWork(1)">Works 1</a></li>
  6.  
  7. which tells the page to go get the URL
  8.  
  9. http://www.leandroerlich.com/works.php?id=2
  10.  
  11. what I'm finding hard to grasp is the extension onto the usual .php convention
  12.  
  13. works.php?id=2
  14.  
  15. what is "?id=2" ??
  16.  
  17. I understand that this maybe also a javascript question so I apologise if I am writing this thread in the wrong place.
  18.  
  19. If anyone can help me I would be very greatful
  20.  
  21. blunt
  22.  
No, this is not a javascript question. Do some search on google for GET and POST method.

Also, if you really want to learn programming, go to http://www.w3schools.com/
Reputation Points: 21
Solved Threads: 26
Posting Whiz in Training
Rhyan is offline Offline
240 posts
since Oct 2006
Nov 24th, 2008
0

Re: PHP extension querie! .php?id=2

this is how you pass info from one page to another. lets say thats an id of some item from the other page. like a book for a library page. when you click the image or link it will have something like
html Syntax (Toggle Plain Text)
  1. <a href="info.php?id=2> link</a>

this carries the book id to the next page. from the next page you can pull that id from the url.
php Syntax (Toggle Plain Text)
  1. $id = $_GET['id'];
now you can pull data from the db using the $id.
php Syntax (Toggle Plain Text)
  1. $bookinfo = mysql_query('select * from books where bookid = .$id.') or die(mysql_error());

that is why urls have the ?id=2
Reputation Points: 31
Solved Threads: 29
Posting Whiz in Training
ProfessorPC is offline Offline
270 posts
since Dec 2007
Dec 2nd, 2008
0

Re: PHP extension querie! .php?id=2

There are 2 ways to pass an information in web.. It is either through POST or GET..

if you see and extension of index.php?id=1 .. it means that the page is trying to send an information. This is like saying im going to pass variable id which has a value of 1 to index.php
Reputation Points: 10
Solved Threads: 1
Newbie Poster
xarz is offline Offline
24 posts
since Nov 2008
Dec 4th, 2008
0

Re: PHP extension querie! .php?id=2

http://www.leandroerlich.com/works.php?id=2

hi


the id=2 in the above link is a page id,for id=3 its goes to another page

so indicates its a page id
Reputation Points: 10
Solved Threads: 0
Newbie Poster
freeonlinedatin is offline Offline
19 posts
since Nov 2008
Dec 4th, 2008
0

Re: PHP extension querie! .php?id=2

Click to Expand / Collapse  Quote originally posted by blunt57 ...
Hi all I am a beginner with mark up and am trying my hand at HTML, Javascript and PHP. Currently I am copying source code from sites so I can learn and understand the code and rebuild the sites with my own content.

Just recently I came across a site and within the mark up of the page 'works.php' it gives me this href

PHP Syntax (Toggle Plain Text)
  1. <li><a href="javascript:getWork(1)">Works 1</a></li>

which tells the page to go get the URL

http://www.leandroerlich.com/works.php?id=2

what I'm finding hard to grasp is the extension onto the usual .php convention

works.php?id=2

what is "?id=2" ??

I understand that this maybe also a javascript question so I apologise if I am writing this thread in the wrong place.

If anyone can help me I would be very greatful

blunt
after work.php (?id=2) is use to pass parameter to other page or other action
Reputation Points: 10
Solved Threads: 0
Newbie Poster
snadboy6371 is offline Offline
8 posts
since Oct 2008
Dec 4th, 2008
0

Re: PHP extension querie! .php?id=2

after work.php "?" is used for attaching the parameter and id=3 is the parameter.. used for next action
Reputation Points: 10
Solved Threads: 0
Newbie Poster
snadboy6371 is offline Offline
8 posts
since Oct 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: how to connect to remote server usin ssh
Next Thread in PHP Forum Timeline: Resource ID issue





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC