Forum Moderators: coopster

Message Too Old, No Replies

URL in IFRAME

         

shadowclash1

11:15 pm on Feb 17, 2010 (gmt 0)

10+ Year Member



Hello...I've got an iframe that uses this code

<iframe src="http://www.<?=$_REQUEST["url"]?>"></iframe>

So if you go to www.mysite.com/file.php?url=website.com
The iframe shows [website.com...]

But if you just go to www.mysite.com/file.php - The iframe src is just "http://www" - I want to be able to make it that if you haven't specified the url then it by default goes to a another site.

How would I do this?

Thanks

Readie

11:36 pm on Feb 17, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to Webmaster World Shadowclash1!

This should do the trick:

<iframe src="http://www.<?php
$site = $_GET['url'];
if(!isset($site) || $site == "") {
$site = 'some-other-url.com';
}
echo $site;
?>"></iframe>

shadowclash1

11:08 pm on Feb 18, 2010 (gmt 0)

10+ Year Member



Thank you so much! That worked like a charm!