Reputation: 8285
I'm working with drupal. I have this page something.com/node/13. Inside I have this script
<?php
$door = $_GET["variable"];
echo $door;
?>
When I open the URL like this something.com/node/13?variable=1231 I get the following error:
Error message
Notice: Undefined index: variable in eval() (line 2 of /var/www/html/modules/php/php.module(74) : eval()'d code).
and no output. Any ideas what I might be doing wrong?
Upvotes: 0
Views: 2647
Reputation: 385
The error, partcilarly in drupal 7 simply means that you aren't getting any value for $_GET['variable']. This would be because the url doesn't have a value (someurl?variable=foo). You can avoid the notice by prefixing an @ like this:
$door = @$_GET['variable'];
but that won't make the variable return any data. It's pretty unclear from the code you've posted what you're trying to accomplish. You might consider starting there. There is no reason why you can't use $_GET variables in drupal. I do so all the time.
Upvotes: 2
Reputation: 901
Use drupal_get_query_parameters
Because the rewrite rules with Drupal, you don't grab the $_GET values cleanly directly like that.
Upvotes: 0