Re: problem with string param in the query string in php3
| From: | Jesper Juhl | Date: | Fri, 28 Jul 2000 15:38:53 +0000 |
| Subject: | Re: problem with string param in the query string in php3 | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-8797@lists.php.net to get a copy of this message | ||
> I ve the following problem when I pass a string param using the URL
string in php3.
> I call a page with
> pagename.php3?var=val
> and I get the parameter value in the other page using:
> if (isset($var)){
> $theval=$var;
> }
> defined a function included in an external misc include file.
> When I use this with a numerical value all its ok, but when I use this
with a string parameter this doesn´t work.
> why?
Probably becourse you try to pass something like this:
http://www.mydomain.com/mypage.php?var1=5&var2=there
is text and a dollar
sign $ here&var3=9
var1 & var3 are OK, but only var1 will survive as var2 is wrong. You need
to URL-encode the data before passing on. You need to use the urlencode()
function for that.
In urlencoded form it will look like the following, and all is well:
http://www.mydomain.com/mypage.php?var1=5&var2=there+is+text+and+a+dolla
r+sign+%24+here&var3=9
> Is there any standar method for track user session variables other than
pass it in the URL string??.
Yes, there are many ways to do that. Either Pass them as part of the URL
or use a Cookie, you could also store it as session data in a file,
shared memory or a database.
Best regards,
Jesper Juhl
juhl@eisenstein.dk