Page 1 of 1
no output to page in Iframe
Posted: Sun Oct 23, 2011 4:35 pm
by gua
I have an Ifram on one HTML-page (page1.php)with information from another HTML-page(page2.php).The iframe can bee updated
with information from a form and databaseinformation on page1.
Is it posssibel to stop a php-script in page2.php ("die") witn NO output from that page if I do not want to update
the ifram on page1.php . I want the old data in the iframe still be visible ( not a new blank new page)
Thanks in advance
gunnar
Re: no output to page in Iframe
Posted: Mon Oct 24, 2011 1:13 pm
by egg82
I read this four times now and I still don't quite get it...
Do you mean something like this?
Code: Select all
<?php
echo('<div id="friendsDiv" onMouseOver="clearInterval(x);" onMouseOut="newInterval();"></div>');
?>
<script type="text/javascript">
function getFriends(){
var xmlhttp;
xmlhttp=new XMLHttpRequest();
xmlhttp.onreadystatechange=function(){
if(xmlhttp.readyState==4 && xmlhttp.status==200){
document.getElementById("friendsDiv").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","../friends.php?rnd="+Math.random(),true);
xmlhttp.send();
}
</script>
<script type="text/javascript">
getFriends();
function newInterval(){
x = setInterval('getFriends()', 1000);
}
</script>
Re: no output to page in Iframe
Posted: Mon Oct 24, 2011 4:18 pm
by gua
I will try to explain a little better.
Page1.php contains a DIV with an Iframe and one form with some input-areas and commit-button.
On commit of the form the action page, Page2.php, will write some information into the iframe
on page1.php ( witout updateing page1.php).
Sometimes an IF-statement inside Page2.php states that there is NO new information to be written and then I would
like to stop the php-script witout sending anything from page2.php.
If I use function die an empty page will be sent an if I send the same page again ther will be a rewrite blink in the
Iframe-part of Page1.php an that is not so nice.
Is it possible to understand what I mean now??
Thanks in advance
Gunnar
Re: no output to page in Iframe
Posted: Mon Oct 24, 2011 8:56 pm
by egg82
yeah, I understand. Problem is, I know PHP more than javascript, and it looks like most of your work will be in javascript. Try posting in that forum.
Re: no output to page in Iframe
Posted: Tue Oct 25, 2011 7:28 am
by gua
Good that I could describe what the problem is!
The code is onely PHP and is executed on the server.
What I need is a PHP command like "die" that will stop
th php-script on Page2.php and NOT send anytyng att all to the client WEB-browser.
Regards
Gunnar
Re: no output to page in Iframe
Posted: Tue Oct 25, 2011 10:40 am
by egg82
oh, you mean not output anything.
If that's the case, don't echo anything and use exit();
Re: no output to page in Iframe
Posted: Wed Oct 26, 2011 5:50 am
by gua
I have tested but it seems to work like "die"
and sends an empty (blanc ) page to the client WEB-browser.
Regards
Gunnar
Re: no output to page in Iframe
Posted: Thu Oct 27, 2011 4:46 pm
by egg82
That's what it's supposed to do. You can't send "nothing". Nothing is a blank white page. exit() and die() don't send anything. What you're doing is fetching another page in an iframe. If the other page is blank, or nothing is written on it, it appears as a (you background color) page with nothing on it. You can't send or receive "nothing" in PHP.