Forum Moderators: open

Message Too Old, No Replies

URL Inline Encoding Possible?

         

lixy

7:28 pm on Nov 3, 2006 (gmt 0)

10+ Year Member



I would like to know if it is possible to employ the escape() function inline something like the following:

<script language="JavaScript" src="http://www.mydomain.com/script.php?src=(escape("{$var[1].url_value}") ) " type="text/javascript"></script>

The above does not work but I think I am on the right track and just need a little direction. Basically script.php requires that the URL being passed as src be encoded however the URL is stored in {$var[1].url_value} decoded. Any help would be greatly appreciated.

whoisgregg

11:58 pm on Nov 3, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Since you are echoing the variable with PHP, you can just use PHP's urlencode function [php.net] to prepare the value to be used in a URL. :)