Hello, D.I.C.
I don't know if this is in the correct forum, but I should assume so since my primary language is in PHP.
I'm using mod_rewrite to make my URL's look a little more prettier than what they would be without it. Since using them, I can't seem to pass any $_GET variables - they just don't pass all together.
In my PHP document, I'm debugging using: <?php foreach ( $_GET as $g => $d ) { echo "{$g} = {$d}<br />"; } ?> and the only parameters which are being passed are those specified in my .htaccess - if I use the address bar to input a get variable, the debugging code doesn't print anything else out, only the aforementioned.
Am I doing something wrong? I hope it's a quick fix and I'm just being a plonker.
Thanks in advanced, always appreciated.
~huzi
No GET variables, thanks to Apache
Page 1 of 16 Replies - 465 Views - Last Post: 14 December 2012 - 04:27 PM
Replies To: No GET variables, thanks to Apache
#2
Re: No GET variables, thanks to Apache
Posted 02 December 2012 - 04:14 PM
since you rewrite the URL before it reaches the PHP interpreter, only those from rewriting are received. if you have additional parameters that ain’t passed along in the .htaccess as well, they’re gone.
#3
Re: No GET variables, thanks to Apache
Posted 02 December 2012 - 07:48 PM
Use this -
<?php echo '$_GET['your value'];' ?>
#4
Re: No GET variables, thanks to Apache
Posted 03 December 2012 - 02:33 AM
#5
Re: No GET variables, thanks to Apache
Posted 14 December 2012 - 04:09 PM
Groudon, on 03 December 2012 - 02:48 AM, said:
Use this -
<?php echo '$_GET['your value'];' ?>
I feel insulted by this reply. If I was just having trouble retrieving a value from the GET array, I'd simply debug, like so:
<?php
foreach ( $_GET as $key => $data ) {
echo '$_SERVER["'.$key.'"] = "'.$data.'";<br />'.PHP_EOL;
}
?>
However, this isn't my problem - it's a little more complex than that. And for your unhelpful post, I have given you minus 1 reputation, along with the others.
Thanks for your replies
~huzi
#6
Re: No GET variables, thanks to Apache
Posted 14 December 2012 - 04:21 PM
huzi8t9, on 15 December 2012 - 12:09 AM, said:
If I was just having trouble retrieving a value from the GET array, I'd simply debug, like so:
some slightly faster ways for that (in descending order for debugging usefulness):
* var_dump($_GET);
* var_export($_GET);
* print_r($_GET);
PS. I wouldn’t print $_SERVER for $_GET, some keys may turn out misleading (i.e. $_GET is user-provided, $_SERVER not).
#7
Re: No GET variables, thanks to Apache
Posted 14 December 2012 - 04:27 PM
Dormilich, on 14 December 2012 - 11:21 PM, said:
huzi8t9, on 15 December 2012 - 12:09 AM, said:
If I was just having trouble retrieving a value from the GET array, I'd simply debug, like so:
some slightly faster ways for that (in descending order for debugging usefulness):
* var_dump($_GET);
* var_export($_GET);
* print_r($_GET);
PS. I wouldn’t print $_SERVER for $_GET, some keys may turn out misleading (i.e. $_GET is user-provided, $_SERVER not).
Those are possible alternatives
I didn't mean to put $_SERVER, just getting ready for bed - I think it's time.
~huzi
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote



|