By david.archibald on
Greetings
First, as a relative newbie to Drupal I am amazed at what I have been able to do with a number of sites and a limited knowledge of PHP :)
I have what I suspect is a simple problem and I apologise in advance if it is covered elsewhere ... altho I have searched this forum and googled extensively.
I am migrating a database driven app which displays database driven info based on a id value ie show?id=1068.
How do I access the querystring value $id from a PHP script within Drupal?
My thanks in advance.
Comments
<?php$value =
dLd
Thanks!
I'm not sure whether to be grateful or embarassed or both!
But thanks for helping a newbie - it is appreciated.
No problem - I didn't know
No problem - I didn't know how to do it either when I first started with PHP/Drupal.
dLd
Drupal 7
For Drupal 7, it seems this is the proper way to get query string parameters
http://api.drupal.org/api/drupal/includes--common.inc/function/drupal_ge...
--
Mathew Winstone
CEO/Co-Founder
Coldfront Labs Inc.
Query parameters
I found a function drupal_get_query_parameters which returns an array (value pairs). Where must I put this general code. Make one module and call it library?
John
This is a time saver
This is a time saver, thanks for the info.
drupal_get_query_parameters
This function does not do any sanitization does it?
No, it doesn't.
No, it doesn't.
Contact me to contract me for D7 -> D10/11 migrations.
You can also try $_SERVER[
You can also try
$_SERVER['QUERY_STRING']-- Pratip Ghosh
Hey David,
Hey David,
Make sure you sanaitize $_GET or $_POST retrievals. Just saying.
Considering David made this
Considering David made this thread 8 years ago, he's probably already done that, or learned the hard way.
Contact me to contract me for D7 -> D10/11 migrations.