PHP extension querie! .php?id=2

Reply

Join Date: Nov 2008
Posts: 1
Reputation: blunt57 is an unknown quantity at this point 
Solved Threads: 0
blunt57 blunt57 is offline Offline
Newbie Poster

PHP extension querie! .php?id=2

 
0
  #1
Nov 24th, 2008
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

  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
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 232
Reputation: Rhyan is an unknown quantity at this point 
Solved Threads: 24
Rhyan's Avatar
Rhyan Rhyan is offline Offline
Posting Whiz in Training

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

 
0
  #2
Nov 24th, 2008
Originally Posted by blunt57 View Post
  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/
" Of all the things I've lost,
I miss my mind the most...."
Mark Twain
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 252
Reputation: ProfessorPC is an unknown quantity at this point 
Solved Threads: 27
ProfessorPC ProfessorPC is offline Offline
Posting Whiz in Training

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

 
0
  #3
Nov 24th, 2008
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
  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.
  1. $id = $_GET['id'];
now you can pull data from the db using the $id.
  1. $bookinfo = mysql_query('select * from books where bookid = .$id.') or die(mysql_error());

that is why urls have the ?id=2
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 24
Reputation: xarz is an unknown quantity at this point 
Solved Threads: 1
xarz's Avatar
xarz xarz is offline Offline
Newbie Poster

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

 
0
  #4
Dec 2nd, 2008
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
:: xarz ::
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 19
Reputation: freeonlinedatin is an unknown quantity at this point 
Solved Threads: 0
freeonlinedatin's Avatar
freeonlinedatin freeonlinedatin is offline Offline
Newbie Poster

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

 
0
  #5
Dec 4th, 2008
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
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 8
Reputation: snadboy6371 is an unknown quantity at this point 
Solved Threads: 0
snadboy6371 snadboy6371 is offline Offline
Newbie Poster

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

 
0
  #6
Dec 4th, 2008
Originally Posted by blunt57 View 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

  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
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 8
Reputation: snadboy6371 is an unknown quantity at this point 
Solved Threads: 0
snadboy6371 snadboy6371 is offline Offline
Newbie Poster

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

 
0
  #7
Dec 4th, 2008
after work.php "?" is used for attaching the parameter and id=3 is the parameter.. used for next action
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC