I create a html page where are showed the info about the logged user, near the info there is a button that open a form:
<h1 class="personal">Il mio profilo: <button class="add_btn" onclick="mod()">Modifica</button></h1>
    <div class="mobile-screen" id="modform" style="display: none">
        <form action="modifica.php" method="post" id="mod-form">
            <table>
                <button class="login-btn" onclick="mod()">Chiudi</button>
                    <tr>
                        <input type="text" name="memail" id="memail" placeholder="E-Mail">
                    </tr>
                    <tr>
                        <input type="text" name="mpass" id="mpassword" placeholder="Password">
                        <input type="text" name="mmphone" id="mmphone" placeholder="Cellulare">
                    </tr>
                    <tr>
                        <input type="submit" class="login-btn" name="mod" id="signup-btn" value="Modifica">                             
                    </tr>
            </table>
       </form>
   </div>
In this form I added a button that should close it by calling a js function.
This is the button:
<button class="login-btn" onclick="mod()">Chiudi</button>
This is the JS function that is called
function mod(){
    var y = document.getElementById("modform");
    if (y.style.display === "none") {
        y.style.display = "block";
    }else{
        y.style.display = "none";
    }
}
Everytime I click that button it calls modifica.php file
Any idea why it happens?
Modified the button like this:
<button type="button" class="login-btn" onclick="mod()">Chiudi</button>
But it still call modifica.php
 
    