| | |
a basic thing to know....
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
The id to which you refer can mean ANYTHING. Using 'id' in the querystring is just force of habit for most programmers when you want to pass a variable such as member id, page id etc. In these instances, the 'id' is often used for data retrieval from a database or a file. A common usage for this would be to get a record or records from a database table which has a field that has that particular id value.
pHp uses the $_GET variable, in this instance the $_GET['id'] variable, to pass on the data from one page to another as mentioned by adatapost.
Good question.
pHp uses the $_GET variable, in this instance the $_GET['id'] variable, to pass on the data from one page to another as mentioned by adatapost.
Good question.
Happy Humbugging Christmas
•
•
Join Date: Jul 2009
Posts: 23
Reputation:
Solved Threads: 0
•
•
•
•
The id to which you refer can mean ANYTHING. Using 'id' in the querystring is just force of habit for most programmers when you want to pass a variable such as member id, page id etc. In these instances, the 'id' is often used for data retrieval from a database or a file. A common usage for this would be to get a record or records from a database table which has a field that has that particular id value.
pHp uses the $_GET variable, in this instance the $_GET['id'] variable, to pass on the data from one page to another as mentioned by adatapost.
Good question.
•
•
Join Date: Jul 2009
Posts: 23
Reputation:
Solved Threads: 0
hi.. adatapost... with the little understanding of php wht i hav understood is that.. we use request whn v use certain data frm the same page and use the database.. in case of post v use it whn v hav to get the data frm a different page.. forget get for the time being.... how far is my conception right??????????????/
The 'id' to which you refer, is meaningless. It's just a name (or 'key') in a querystring (the bit at the end of the url following '?') to which you can assign a value, which can be almost anything.
e.g. If this is your website and you wanted to send info to a page to delete an user:
You could equally have used:
You would then, in this instance use $_GET['user'] in your delete.php file to get at the data (12389) as opposed to using $_GET['id'] in the first example.
$_GET can also be used with forms if you set the 'method' attribute to 'get'. I would advise against this, use 'post' if possible.
adatapost may get back to you about $_REQUEST, so I won't step on his toes by giving an explanation.
So the querystring (rather than calling it the 'id'), is a way of passing data to the page in question.
BTW: you wouldn't necessarily delete an user through a querystring, there are more secure ways of doing this.
e.g. If this is your website and you wanted to send info to a page to delete an user:
PHP Syntax (Toggle Plain Text)
http://www.example.com/delete.php?id=12389&confirmcode=hy6io98
You could equally have used:
PHP Syntax (Toggle Plain Text)
http://www.example.com/delete.php?user=12389&confirm=hy6io98
You would then, in this instance use $_GET['user'] in your delete.php file to get at the data (12389) as opposed to using $_GET['id'] in the first example.
$_GET can also be used with forms if you set the 'method' attribute to 'get'. I would advise against this, use 'post' if possible.
adatapost may get back to you about $_REQUEST, so I won't step on his toes by giving an explanation.
So the querystring (rather than calling it the 'id'), is a way of passing data to the page in question.
BTW: you wouldn't necessarily delete an user through a querystring, there are more secure ways of doing this.
Happy Humbugging Christmas
•
•
Join Date: Jul 2008
Posts: 149
Reputation:
Solved Threads: 25
Just be very careful when working with values passed in the GET & POST arrays . Its extremely easy for them to be modified by the user and you have to be fully aware of this.
Probably the most common thing i've seen is the usage of $_GET and $_POST in queries or being used to dynamically include files in their raw, straight from the url, forms.
Probably the most common thing i've seen is the usage of $_GET and $_POST in queries or being used to dynamically include files in their raw, straight from the url, forms.
If you're question/problem is solved don't forget to mark the thread as Solved!
-- Code I post is usually but not always tested. If it is tested it will be against 5.2.12 or 5.3.1
-- Code I post is usually but not always tested. If it is tested it will be against 5.2.12 or 5.3.1
![]() |
Similar Threads
- Help needed! Probably very basic! (Java)
- Hardware Interrupts & 100% CPU usage (Windows NT / 2000 / XP)
- Please advise me on increasing the traffic... (Site Layout and Usability)
- NTFS - what can I do? (Getting Started and Choosing a Distro)
- .avi file playing (C++)
- graphics.h supplement? (C++)
- Building a database application (C++)
- Best Web Hosting 4 PHP (Web Hosting Deals)
- Not a newbie, think of me as old school... (Visual Basic 4 / 5 / 6)
Other Threads in the PHP Forum
- Previous Thread: Need a browser based game developer or team of developers
- Next Thread: Retrive data
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array beginner binary broken cakephp checkbox class cms code cron curl database date directory display download dynamic echo email encode error fcc file files folder form forms function functions google howtowriteathesis href htaccess html image include insert integration ip java javascript joomla limit link login loop mail menu methods mlm mod_rewrite multiple multipletables mysql oop open parse paypal pdf php problem provider query radio random recursion regex remote script search select server sessions sms soap source space speed sql structure syntax system table template tutorial update upload url validation validator variable video web xml youtube






