Jump to content

$GET['my.foo']


MadTechie

Recommended Posts

ok a simple question i hope

 

i need to pass a get string but the variable requires a dot (.) but php converts this to a underscore (_) this normally wouldn't be a problem but some variables use the underscore

 

heres some basic code

 

url = index.php?my.foo=hello&my_foo2=world

<?php

print "my.foo:".$_GET['my.foo']."<br />";
print "my_foo:".$_GET['my_foo']."<br />";
print "my_foo2:".$_GET['my_foo2']."<br />";

print_r($_GET);

?>

 

any ideas how to resolve this, as a note the variable names are pulled in from a data file created by the user

Link to comment
Share on other sites

  • 4 weeks later...

Here is one way around the problem, but to use it you will have to change some of your logic.

 

Make the URL look like this:

url = index.php?p[my.foo]=1&p[my_foo]=2

then you could use $_GET['p']['my.foo'] and $_GET['p']['my_foo']

 

Ken

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.