At 20:11 22.02.2001, Tom Harris said:
--------------------[snip]--------------------
>I want to assign a value using the url however the value contains both a ?
>and an & so PHP (or the browser) seems to get confused.
>
>Here's an example:
>
>http://www.mysite.com/index.php?id=23&url=http://www.anothersite.com/file.ph
>p?qid=234&forum=4
>
>Everything after url= should be the value of $url but this is not the case.
>Is there a way to solve this?
--------------------[snip]-------------------- 

Have a look at the rawurlencode() and rawurldecode() functions.

Generally spoken, any variable data passed as GET or POST argument should
_always_ be passed in URLEncoded format. MSIE handles this quite nicely by
auto-encoding unencoded data, but other browsers miss this.

When constructing your GET command line, simply use the rawurlencode()
function for any value.

Example:

<html><body>
<?php

$time = date ("l dS of F Y h:i:s A");
echo "<a href=\"$PHP_SELF?gettime=";

// this line will work everywhere
echo rawurlencode($time);

// this line will work with MSIE only
// echo $time;

echo "\">";
echo $time;
echo "</a><br>gettime = $gettime";

?>
</body></html>

     ...ebird

   >O     Ernest E. Vogelsinger
   (\)    http://www.1-at-web.at/
    ^     ICQ#   13394035


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to