You can encode URLs with urlencode() and decode them by using urldecode()...

try read here:

www.php.net/urlencode 
www.php.net/urldecode 


### my way:
### you pass $url:

$url = www.maxim.cx/get.php?this=variables&as=many&as=you&what=want
echo "<a href=\"$PHP_SELF?url=".urlencode($url)."\">";


### and you catch it with:

<?
switch($x){ 
case "frame": 
?>
        <frameset framespacing="0" border="0" frameborder="NO" rows="135,*">
        <frame name="top" src="header.shtml" marginwidth="0"
marginheight="0" scrolling="NO" noresize>
        <frame name="textarea" src="<? echo urldecode($url); ?>"> 
<? 
break; 
} 
?>



Cheers,
Maxim Maletsky





-----Original Message-----
From: Jason Dulberg [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 06, 2001 3:09 PM
To: [EMAIL PROTECTED]
Subject: [PHP] framing search results


I'd like to create a script that will frame search results made by various
databases. I will be hardcoding these links into an HTML page. Since there
will be alot of these links and I will be using the script across several
virtual hosts, I can't have the links built by a db as they link to offsite
stuff.

My problem so far is that if I try to link to a search result (which is
obviously built by a database), I get a bunch of errors because the &, =, ?
etc. fields are dropped. So basically, I need to escape the ?,&'s etc. in
the url. I can do this in perl (cgi::escape) but I'm not quite sure how to
do it in php. Couldn't get it to work properly in perl so I'm crossing over
to PHP to see if its doable.

Here's what I got from a code example from zend.com. Basically, I just need
to add the %3A etc onto $url.

<?
switch($x){ 
case "frame": 
?>
        <frameset framespacing="0" border="0" frameborder="NO" rows="135,*">
        <frame name="top" src="header.shtml" marginwidth="0"
marginheight="0" scrolling="NO" noresize>
        <frame name="textarea" src="<? echo $url; ?>"> 
<? 
break; 
} 
?>

Now one thing that I noticed is that often when the url is encoded and I try
the link, I get a 404 error. What am I doing wrong?

So the links that I hardcode into the html is something like
xyz.com/frame.php?page=searchresults.php or something like that.

I'm really new to php so sorry if this is kinda vague. If there's a better
way of doing what I'm trying to above, please let me know!

Thanks in advance for your help!
__________________
Jason Dulberg
Extreme MTB
http://extreme.nas.net


-- 
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]

-- 
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