Get the value of the variable url for iframe

Asked

Viewed 449 times

-1

I would like help see the example:

http://www.site.com/pagina.php?url=http://www.valordavariavel.com

In my php: page.php I have iframe:

<iframe src="" width="100%" height="100%" scrolling="no" frameborder="0"  allowfullscreen="true"></iframe>

Now how do I get the variable value url for iframe src=""

the result I would like to get is:

<iframe src="http://www.valordavariavel.com" width="100%" height="100%" scrolling="no" frameborder="0"  allowfullscreen="true"></iframe>

I’ve tried to:

<iframe src="<?php echo $url; ?>" width="100%" height="100%" scrolling="no" frameborder="0"  allowfullscreen="true"></iframe>

But it did not work, thank you in advance for the attention thank you!

  • 1

    "It didn’t work out" is too vague. How did the page source with your attempt? You did $url = $_GET['url']; before that line? On a well-configured server, $_GET is fundamental.

  • I didn’t put the get how do you could write the code here for me?

  • 1

    This is exactly what is written in the previous comment. In the PHP part of your code you have to put the mentioned line, or use the $_GET['url'] in the echo

1 answer

3

Just use the method GET:

$url = $_GET['url'];

And in the iframe place:

<iframe src="<?php echo $url; ?>" width="100%" height="100%" scrolling="no" frameborder="0"  allowfullscreen="true"></iframe>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.