Anubis Posted February 28, 2008 Posted February 28, 2008 Could someone put a small tutorial up on this subject of url encoding? I think this would be a invaluable tool for some of us that are newer to php and mysql. I have not ventured into this area yet so any help would be much appr. Thanks Quote
Floydian Posted February 28, 2008 Posted February 28, 2008 Re: Url Encode there isn't much to it when you need to echo out URL links that might contain special characters, urlencode() you string Say you wanted to pass the value: ?action=view_item&id=23&link_back=auction&link_back_action=action=view_auction Perhaps this is a bit too complicated, but, let's view this broken up into composite parts. ?action=view_item that is the variable that controls the switch id=23 that is the item id link_back=auction you can match that up to an array that gives you a file name for the auction $file_names = array('auction' => 'auction.php'); that way you're link is secure link_back_action=action=view_auction ah, here we have something that needs to be urlencoded link_back_action <<<< that is the variable name action=view_auction <<<< that is the value but that equal sign is gonna be a pain That value could easily be something more complex, suppose you wanted to include the auction ID (to match up the particular auction item) action=view_auction&id=1234 so now you have a string you want to pass in the URL that you DO NOT WANT BROKEN UP INTO variable => value pairs $link_back = urlencode('action=view_auction&id=1234'); and now the value you will pass in the URL is: ?action=view_item&id=23&link_back=auction&$link_back And now you have a complex string with control/special characters in it that can be passed as one variable => value pair. You don't have to urldecode that on the other end. Any ways, there's many many uses I'm sure, but it really comes down to, are you trying to pass something in a URL that won't work? If it's not working, try URL Encoding it Are you trying to use something passed in a URL that won't work, try URL Decoding it. :-) Quote
Anubis Posted March 3, 2008 Author Posted March 3, 2008 Re: Url Encode Great, Thank you! If your ever looking to make some side money let me know lol! Quote
Floydian Posted March 3, 2008 Posted March 3, 2008 Re: Url Encode I'm definitely open to doing some coding for you. What did you have in mind? Quote
Anubis Posted March 3, 2008 Author Posted March 3, 2008 Re: Url Encode PM sent to ya. Just let me know! Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.