Jump to content

Recommended Posts

I've written my site using &sub in my url for getting to certain sub-pages. The only problem is that when I use the php variable $_SERVER["REQUEST_URI"] I get back a math character '⊂' . Strange. Technically, that should equal ⊂ but my url doesn' have the semicolon. I thought I could just replace the ⊂ with &sub in my script and it would work, but my editing tools don't recognize the character!

Worst case scenario is that I'm going to have to rewrite my whole site to use a different variable for the sub-page. That is unless someone here has a bright idea!

Word to the wise - don't use &sub as a variable in your script for URLs.

(as in ?page=this&sub=that)

There's alot more to avoid too...

[a href=\"http://en.wikipedia.org/wiki/Help:Filling_the_page\" target=\"_blank\"]http://en.wikipedia.org/wiki/Help:Filling_the_page[/a]

See the bottom of this page for more...
Link to comment
https://forums.phpfreaks.com/topic/11617-help-ive-got-a-prob-using-sub-in-my-url/
Share on other sites

[!--quoteo(post=382085:date=Jun 9 2006, 05:40 PM:name=poirot)--][div class=\'quotetop\']QUOTE(poirot @ Jun 9 2006, 05:40 PM) [snapback]382085[/snapback][/div][div class=\'quotemain\'][!--quotec--]
That's because it's a HTML entity. You should use:

?page=this&sub=that
[/quote]

That's for HTML output, not URLs I believe. URL encoding is different.

I actually tried that, but my script didn't recognize that.

& should be correct for PHP and it does normally work.
OK, then that's just the "HTML illusion".

Actually PHP understands that it is &sub and not the math symbol, but once it's printed the browser thinks it's the entity.

Internally there should be no issue, but if you want it to be displayed correctly, use htmlentities($_SERVER['REQUEST_URI']);
[!--quoteo(post=382092:date=Jun 9 2006, 06:08 PM:name=poirot)--][div class=\'quotetop\']QUOTE(poirot @ Jun 9 2006, 06:08 PM) [snapback]382092[/snapback][/div][div class=\'quotemain\'][!--quotec--]
OK, then that's just the "HTML illusion".

Actually PHP understands that it is &sub and not the math symbol, but once it's printed the browser thinks it's the entity.

Internally there should be no issue, but if you want it to be displayed correctly, use htmlentities($_SERVER['REQUEST_URI']);
[/quote]

Ah, maybe that would have worked. I actually just finished combing through my scripts and updating the &sub variable to something else, and now the REQUEST_URI works like I thought it would.

Thanks for your tips...
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.