I currently have a line in my .php like this:

echo "<li><b>DHCP Starved?</b> <input type ='checkbox' id ='DHCPs'> </li>";

This prints a checkbox on my page. However, my page is designed to refresh every 9 seconds.
How do i make the checkbox stay checked / unchecked instead of default, even after page refresh?

I've done some searching and honestly i have no idea how to do jquery.

    One option, use an AJAX/DOM approach to only update the portion of the page that actually needs updating, not the whole page.

    Option two: use and onclick event (or whatever is right for a checkbox?) to send an AJAX request that will store the current state in a session variable or a cookie, then use that if present to set the state of the box on display.

    Option three: whatever I haven't thought of yet.

      I'd strongly suggest investigating AJAX and DOM, but be aware of the amount of time necessarily to get up-to-speed on that if you're not familiar with JavaScript at all (you don't say that, you say you're not acquainted with jQuery ... and there's a bit of connection between the two).

        I would say that if you are refreshing your entire page (markup and all) every nine seconds AND you expect users to interact with that page, then you are doing something wrong. As NogDog and Dalecosp point out, you should probably set up your page to use ajax polling. You might try googling "ajax polling" or "single page application" for more information. Generally speaking, I think it's probably a bad idea to repeatedly refresh any page with form elements.

          Write a Reply...