Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Problem with # in URL!
Old 09-22-2007, 01:16 PM Problem with # in URL!
Average Talker

Posts: 20
Trades: 0
I'm making something that retrieves the URL the user types in, so far it's working. However i noticed there are some characters the browser handles differenty e.g. #,$,%,^,&,*,!,~,@ (ascii chars) etc etc. Is there someway those characters can be used in a URL without causing errors?

Last edited by koolaid; 09-22-2007 at 01:33 PM..
koolaid is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 09-22-2007, 03:48 PM Re: Problem with # in URL!
NullPointer's Avatar
Will Code for Food

Posts: 2,815
Name: Matt
Location: Irvine, CA
Trades: 0
Those characters have special meanings in the context of a url. How are you trying to use them?
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
NullPointer is online now
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Old 09-22-2007, 03:49 PM Re: Problem with # in URL!
rogem002's Avatar
PHP Chap

Posts: 843
Name: Mike
Location: United Kingdom
Trades: 0
If you want to fix the problem use:

urlencode and urldecode.

For example:
PHP Code:
<?php
// Preparing a URL.
echo '<a href="http://www.rogem.net/page.php?var='.urlencode("value").'">';

// decoding whats recived.
echo urldecode($_GET['var']);
?>
If your not into people seeing whats being sent, try a Base64 (This is super cool):
PHP Code:
<?php
// Preparing a URL.
echo '<a href="http://www.rogem.net/page.php?var='.base64_encode("value").'">';

// decoding whats recived.
echo base64_decode($_GET['var']);
?>
__________________
My Blog/Site:
Please login or register to view this content. Registration is FREE

Last edited by rogem002; 09-22-2007 at 03:53 PM..
rogem002 is offline
Reply With Quote
View Public Profile Visit rogem002's homepage!
 
Reply     « Reply to Problem with # in URL!
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.11398 seconds with 12 queries