*.php?**

diabolo

Community Advocate
Community Support
Messages
1,682
Reaction score
32
Points
48
what is this called?

at the end of a file extension it has the '?' and some stuff after it
for ex:
Code:
http://forums.x10hosting.com/newthread.ph[COLOR=Blue]p?do[/COLOR]=newthread&f=103
the part in blue
 

DarkDragonLord

New Member
Messages
782
Reaction score
0
Points
0
I always call it variable but i dont know if its the correct name.

Anyways, '?' shows php that is coming a variable and then, the 'do' is the variable... the '=' set the value of the 'do' variable as 'newthread' and the '&' gives php another variable to work with, the variable 'f', that is inheriting the value '103'
 

Livewire

Abuse Compliance Officer
Staff member
Messages
18,169
Reaction score
216
Points
63
I think it's called passing an argument.

So far hatbocs is the closest to being on the right track.


Look up HTTP GET for more on what it is.

Basically, its one of HTTP's primary two methods for passing information to a page that's about to load (the other being HTTP POST, which is pretty much identical but you don't see the variable in the url). The filename is still newthread.php, however where you see this:

?do=newthread&f=103

We can break that down - it is passing two variables to newthread.php:

The first is do. It is going to have the script set something to the value "newthread", so the script knows it's making a new thread.

The other part, f and 103, is likely the forum index - that'd tell the script to make it in board # 103, otherwise known as Programming Help :)


So hatbocs was right, it's passing an argument. It's just got a name to go with it too :)



Edit: Forgot to explain the ? mark - the ? mark is so the webserver knows where the filename ends, and where the HTTP GET begins.

Edit 2: AAAAAND forgot one more thing: that is not restricted to php. You'll see it with html and other filetypes as well (although beyond html, php, and maybe a .js file I haven't seen it used much - those are the main filetypes you see being used that need an argument passed to it).
 
Last edited:

diabolo

Community Advocate
Community Support
Messages
1,682
Reaction score
32
Points
48
thanks, so this is like with the form
how the have the post method="get", or "post"
 

Adam01

New Member
Messages
114
Reaction score
0
Points
0
Normal when using get:

<form action='submit.php' method='get'>
</form>

The form sends off every form field and adds the data to the end of 'submit.php?formdata=...
 
Top