OsiViper Posted September 22, 2006 Share Posted September 22, 2006 Ok quick question with some php code and i have no idea how to have it do what i wantIm retreiving these 3 vars from a previous page:$name = $HTTP_POST_VARS['Name'];$class = $HTTP_POST_VARS['Class'];$level = $HTTP_POST_VARS['Level'];Which are then emailed to me, the email contains a link to a different page what has some HTTP_GET_VARS on ithttp://www.webpage.cc/test.php?name=$name&class=$class&level=$levelThat all works out fine. My problem is, on the main page where people put the information in the textboxes, is some of the stuff they need to put spaces, commas, etc in, and in the email that breaks the link, how do i have it encode the url removing the spaces/commas/other symbols so it comes out as a whole link in the email?I know this is probably pretty simple, but im still just learning PHP Quote Link to comment https://forums.phpfreaks.com/topic/21640-http-post-vars-into-a-url/ Share on other sites More sharing options...
wildteen88 Posted September 22, 2006 Share Posted September 22, 2006 Use [url=http://php.net/urlencode]urlencode[/url]. On the values from your form inputs. So you'll want to do something like this:[code=php:0]$name = urlencode($HTTP_POST_VARS['Name']);$class = urlencode($HTTP_POST_VARS['Class'];)$level = urlencode($HTTP_POST_VARS['Level']);[/code]When you retrieve the them from url you'll wnt to decode then with [url=http://php.net/urldecode]urldecode[/url]Eg:[code=php:0]$name = urldecode($HTTP_GET_VARS['Name']);$class = urldecode($HTTP_GET_VARS['Class'];)$level = urldecode($HTTP_GET_VARS['Level']);[/code] Quote Link to comment https://forums.phpfreaks.com/topic/21640-http-post-vars-into-a-url/#findComment-96572 Share on other sites More sharing options...
OsiViper Posted September 22, 2006 Author Share Posted September 22, 2006 Cool, that worked :)Thanks a ton! Quote Link to comment https://forums.phpfreaks.com/topic/21640-http-post-vars-into-a-url/#findComment-96971 Share on other sites More sharing options...
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.