View Full Version : PHP clear content command
Jonny Two Shoes
21-01-2007, 06:29 PM
Simple question here if possible :)
Im running a query to mysql using a php loop. When the statement registers as true I would like it to clear the page contents and write the new info.
!!!So basically im looking for a clear content!!! php command so it can do this....searching on the web reveals nothing so far.
Im not looking to refresh the whole page or redirect it either
Any help would be appreciated :) thanks. I will gladly provide more info if necessary but this is all I seek....a simple command I do not know :p
From my limited experience, i dont think that would be possible? But maybe you could get the php to output javascript to do it. Found this javascript for clearing the window with a Google search. http://www.js-examples.com/page/javascripts__example.html?view=1060
reech
22-01-2007, 02:26 PM
ajax
Kloon
22-01-2007, 03:35 PM
Put your all your content into a div tag and just change the innerHTML property to "" that will clear everything
Hehe, that would work better :)
Jonny Two Shoes
24-01-2007, 07:57 AM
Put your all your content into a div tag and just change the innerHTML property to "" that will clear everything
Hey thanks will give it a try. :) thanks for replies everyone :D
Kloon
24-01-2007, 08:27 AM
btw you'll have to do that with javascript function. Say your div id is "cont" your javascript will look like this.
<script langauge="javascript">
function clear()
{
getElementById("cont").innerHTML = "";
}
</script>
then just call clear when you need it.
marjo
01-03-2007, 07:29 PM
AJAX is the way to go, but I think that kloon's way would work.
BobbyMac
11-03-2007, 10:04 AM
Simple question here if possible :)
Im running a query to mysql using a php loop. When the statement registers as true I would like it to clear the page contents and write the new info.
!!!So basically im looking for a clear content!!! php command so it can do this....searching on the web reveals nothing so far.
Im not looking to refresh the whole page or redirect it either
Any help would be appreciated :) thanks. I will gladly provide more info if necessary but this is all I seek....a simple command I do not know :p
If I'm reading this right then you're trying to change what is already on the screen while continuously executing the existing script? If so, then the only conceivable way of doing this is with flushing what's in the script buffer to the screen, and then following kloon's idea or going AJAX. Using this, however, would significantly increase resource usage by PHP. (see: http://www.php.net/manual/en/function.flush.php for more info but again, please heed my warning that this is going to put a strain on your server). If you mean submit information "behind the scenes" to a script and then if your conditions are met you want to "clear the screen", then AJAX is first prize.