...

View Full Version : What is this code for?



bluecode
03-25-2007, 11:39 PM
Hi! Everyone,

I'm an artist developing my Online portfolio http://bluepen-graphics.com am starting to learn how to convert my html web page to php.

I want to ask info about "?do=newthread&f=6" from "http://www.codingforums.com/newthread.php?do=newthread&f=6"

My question is how this code work "?do=newthread&f=6" what it is for?

Thank you in advance for the info that you can give.

-bluecode (PHP noob)

jmitch18
03-25-2007, 11:51 PM
Those are called get variables and can be accessed using $_GET['name'].

In the example you gave the two get variables would be $_GET['do'] (with the value of newthread) and $_GET['f'] (with a value of 6).

This basically allows you to pass information easily between pages. You can use it in links like in this example:


<a href="test_page.php?action=dosomething">Click me</a>

And can be accessed and used like this:


if(isset($_GET['action'])){
if($_GET['action'] == "dosomething"){
// do something
}
}


You can also use it in headers and form actions (See below):


<form action="blah.php?test=something" method="post">

and


header("location: test.php?blah=something");

Hope that helps :)

bluecode
03-26-2007, 12:49 AM
Wow! Thank you so much jmitch18 for enlighten my thinking for this code.

Really helped me... So clear and easy to understand... 2 thumbs up!

Thanks again...

bluecode
04-01-2007, 10:33 PM
Hi! Jmitch18,

one more question, correct me if am wrong. here's the call link example to a site.

"http://blabla.com/?a=details&lid=3376"

are this link omitted the index.php that supposedly to

"http://blabla.com/index.php?a=details&lid=3376"


Thank you again.

bluecode

danielwarner
04-01-2007, 11:51 PM
yup you can miss off the index.php if its a root directory

the-dream
04-02-2007, 06:29 PM
Hi just for reference i made a tutorial for that its free:
http://phpguy.wordpress.com/2007/03/25/url-id-content/



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum