first off all, i want to thank for this site, it helped me alot. So, I want to do a button/switch that when it is pressed it passes a value "1" to another page and when it's not pressed (default) it passes the value "0". I already have a code that i made with the help of user of this site and youtube:
 <script type="text/javascript">
    function onoffalarm(){
    var onof = document.getElementById('onof');
    var switchonoff = document.getElementById('switchonoff');
    if(onof.style.display=="block")
    {
        onof.style.display= "none";
        switchonoff.src= "images/buttonOFF.png";
        switchonoff.title= "Turn On";
        window.location.href="led.php?value=0";
    }else{
        onof.style.display="block";
        switchonoff.src= "images/buttonON2.png";
        switchonoff.title= "Turn OFF";
        window.location.href="led.php?value=1";
    }        
}
<img id="switchonoff" onmousedown= "onoffalarm()" src="images/ButtonOFF.png" width="217" height="217" alt="" title="Turn On">
<div id="onof">
</div>
With this code, the only value that passes to "led.php" is "1", but as i said, i want it to pass the value 1 when pressed and 0 when it is not pressed. Adicionaly, I also want to know how can i save the button state when i make a refresh for exemple. How do i do that.
Seen Already
https://www.youtube.com/watch?v=A-3BxXdISG8
Thanks for the help
 
    