Consider below url.
www.yourdomain.com/pagename.php?id=10
In pagename.php file, we should add below code to use this querystring parameter ‘id’.
$id=$_GET[‘id’];
Based on server setting or php.ini values, we can use $id even without using above code.
(i-e PHP variable ($id) will be automatically created based on name of the querystring parameter (‘id’) and querystring value will be assigned to this PHP variable.)
But the good practice is, we should always use the explicit assignment (e.g $id=$_GET[‘id’];) to avoid unnecessary issues which will occur if the server setting doesn’t allow the automatic assignment.
More Articles...
Tuesday, April 14, 2009
Always explicitly use $_GET when using querystring parameters in PHP.
Related Posts
- Difference between creating objects in PHP and Python
- Sample PHP code for using Google Gemini API
- PHP developer Career opportunities suggested by Gemini
- Challenges in Developing and Testing PHP Script for Automatic Resume Submission
- PHP Code to have different number of rows in first page of PDF file generated by FPDF Library
Search This Blog

AI Course | Bundle Offer | Unlocking AI | Dream Big | Listen to Dream Big
Today's Deals | Timesheet | Products | SQL ebook | Earn 50% commission
About | Privacy | Follow | TOS | WhatsApp | Contact
I may earn a commission from Amazon affiliate links
No comments:
Post a Comment