Page 1 of 1

Problem passing $_GET variable

Posted: Thu Nov 13, 2008 5:02 pm
by iG9
So I'm processing a registration form, and if there's a problem I'm passing back what they entered so they don't have to retype it. so the URL looks like ...register.php?variable1=value1&variable2=value2 and so on. The problem comes when the user puts a '#' in their address. when it gets passed back it and all the variables after it get ignored. I think they're seen as a comment. So for example

Code: Select all

register.php?emailEntered=test@test.com&password=1&fnameEntered=John&lnameEntered=Smith&addr1Entered=100%201st%20St%20#3&addr2Entered=&cityEntered=Beverly Hills&stateEntered=CA&zipEntered=90210
is only being seen as

Code: Select all

register.php?emailEntered=test@test.com&password=1&fnameEntered=John&lnameEntered=Smith&addr1Entered=100%201st%20St%20#
by the page and the later fields aren't repopulating even though I see them in the URL. Any ideas how to pass back the # safely? Thanks.

Re: Problem passing $_GET variable

Posted: Thu Nov 13, 2008 5:32 pm
by VladSun

Re: Problem passing $_GET variable

Posted: Thu Nov 13, 2008 8:34 pm
by iG9
Thanks man I'll give it a try.

Re: Problem passing $_GET variable

Posted: Fri Nov 14, 2008 5:43 pm
by iG9
Got it working. I used urlencode() on the processing page and

Code: Select all

parse_str(urldecode($_SERVER['QUERY_STRING']));
on the registration page. Then I had to change the logic from hanging on

Code: Select all

$_GET['variable']
to just

Code: Select all

$variable
The parse_str() man page had a comment to the effect that it would do an urldecode automatically but I didn't find that to be the case. Anyway thanks.