Welcome to WebmasterWorld Guest from 35.172.195.49

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Passing an argument with & in the URL

     
6:14 pm on Sep 17, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Feb 17, 2003
posts:687
votes: 0


I want to pass a dynamic URL (URL 1) which contains & as an argument in another URL (URL 2)

url1.php?a=apple&b=boy

url2.php?c=url1.php?a=apple&b=boy

it ends up url2.php receive 2 arguments - c and b

instead of just 1 c argument.

How do I made a success pass of argument with & in it?

6:39 pm on Sept 17, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Aug 21, 2003
posts:1069
votes: 0


Why not just do this:

url2.php?c=url1.php&a=apple&b=boy

and have 3 arguements that you can put back together.

JAG

8:47 pm on Sept 17, 2003 (gmt 0)

Junior Member

10+ Year Member

joined:Oct 8, 2002
posts:65
votes: 0


>url2.php?c=url1.php?a=apple&b=boy

The reason that didn't work is that you only want one question mark. After that, use the ampersand.

url2.php?c=url1.php&a=apple&b=boy

1:27 pm on Sept 18, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Feb 17, 2003
posts:687
votes: 0


actually I want to build a redirect script that has an URL has its arguments.

But some dynamic URL has the & in it where the redirect script would tought it to be the 2nd argument instead of a complete URL.

What is your thoughts?

4:11 pm on Sept 18, 2003 (gmt 0)

Preferred Member

10+ Year Member

joined:Jan 31, 2003
posts:457
votes: 0


urlencode() [php.net] Encode the second url.

ie:

<?
$urlparam="http://www.webmasterworld.com/epostz.cgi?action=reply&forum=88&discussion=1741";

$url="http://www.example.com/redir.php?option=1&name=daisho&url=".urlencode($urlparam);

Header( "Location: $url" );
?>

That should do the trick.

Daisho.