I was just wondering if it is possible to put a php echo inside an iframe? something like this:
<iframe src="<?php echo $dyn; ?>" width="800" height="500" scrolling="yes"></iframe>
and if not, what is the correct way of doing this?
I was just wondering if it is possible to put a php echo inside an iframe? something like this:
<iframe src="<?php echo $dyn; ?>" width="800" height="500" scrolling="yes"></iframe>
and if not, what is the correct way of doing this?
The way PHP works is that work is done behind the scenes, before the HTML is even sent, so by the time that you actually send the full data to the user, it's parsed into what should be given to the browser.
That is to say, when for example
<?php
$dyn = "index.html";
?>
<iframe src="<?php echo $dyn; ?>" width="800" height="500" scrolling="yes"></iframe>
By the time that the server breaks it all down, the browser will only ever see
<iframe src="index.html" width="800" height="500" scrolling="yes"></iframe>
That's why you can use HTML and PHP on the same page, because the server parses the PHP before it's sent to the browser, so you end up just sending Text/HTML to the end location. Echo is simply the means of telling PHP, "Instead of just doing this, show the user this result.", and it builds it around the HTML you already have present.