php file
<button id='submit' name='submit' ><h1>Schedule</h1></button>
<?php
      include 'dbres.php';
      if (isset($_POST['submit'])){
        $sql = "UPDATE reserved SET reserved = false WHERE reserved = true;";
        $res = mysqli_query($conn,$sql);
        echo'document.getElementById("submit").onclick = function() {
        this.textContent = "reserved";
        }';
      }
    ?>
I want the javascript code inside the php code to changes the text from submit to reserved. I have tested the javascript code and it works by itself, but doesn't seem to work in php.
