Facebook   Twitter    e-mail newsletter    YouTube    RSS Feed    Android App    iPhone and iPad App     BlackBerry App    


Results 1 to 9 of 9

Thread: PHP clear content command

  1. #1
    Grandmaster
    Join Date
    Nov 2006
    Location
    Gauteng
    Posts
    4,544

    Default PHP clear content command

    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

  2. #2
    Senior Member
    Join Date
    Aug 2005
    Location
    London, UK
    Posts
    126

    Default

    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/java...html?view=1060

  3. #3

    Default

    ajax

  4. #4
    Grandmaster Kloon's Avatar
    Join Date
    Nov 2006
    Location
    172.0.0.0/8
    Posts
    1,545
    Blog Entries
    2

    Default

    Put your all your content into a div tag and just change the innerHTML property to "" that will clear everything

  5. #5
    Senior Member
    Join Date
    Aug 2005
    Location
    London, UK
    Posts
    126

    Default

    Hehe, that would work better

  6. #6
    Grandmaster
    Join Date
    Nov 2006
    Location
    Gauteng
    Posts
    4,544

    Default

    Quote Originally Posted by Kloon View Post
    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

  7. #7
    Grandmaster Kloon's Avatar
    Join Date
    Nov 2006
    Location
    172.0.0.0/8
    Posts
    1,545
    Blog Entries
    2

    Default

    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.

  8. #8
    Senior Member marjo's Avatar
    Join Date
    Jan 2007
    Location
    Johannesburg
    Posts
    137

    Default

    AJAX is the way to go, but I think that kloon's way would work.
    Last edited by marjo; 01-03-2007 at 07:33 PM.
    Johannesburg Area Wireless User Group.
    http://www.jawug.org.za - Because information should be free!
    http://www.wug.za.net - no wires, no limits

  9. #9

    Default

    Quote Originally Posted by Jonny Two Shoes View Post
    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
    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.
    Last edited by BobbyMac; 11-03-2007 at 10:07 AM.

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •