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

<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

Recommended Answers

All 6 Replies

Member Avatar for Rhyan
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

<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

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/

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

<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.

$id = $_GET['id'];

now you can pull data from the db using the $id.

$bookinfo = mysql_query('select * from books where bookid = .$id.') or die(mysql_error());

that is why urls have the ?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

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

<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

after work.php "?" is used for attaching the parameter and id=3 is the parameter.. used for next action

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.