I am having trouble in this functions. I would like to retrieve all the information and put the value into the input box straight away.
I tried using JavaScript and PHP code but I don't know why my code is not working.
HTML:
 <label>Em Part No</label>
 <input type="text" class="form-control" id="emPartNo_insert" placeholder="Em Part No" name = "emPartNo_insert" onkeyup="updating()" required="" autofocus="">
 <label>Description</label></br>
 <textarea class="form-control" id="description_insert" name="description_insert" form="moduleform_insert" placeholder="Description" required=""></textarea>
JAVASCRIPT WITH PHP Code
        function updating(){
        var emPartNo = document.getElementById("emPartNo_insert").value;
        <?php
        $partno_passing="<script>document.writeln(emPartNo);</script>";
        $sql = "SELECT * FROM partMaintainanceModule where emPartNo='$partno_passing'";
        $result = $connection->query($sql);
        if ($result->num_rows > 0) {
                // output data of each row
                while($row = $result->fetch_assoc()) {   
        ?>
        document.getElementById('description_insert').value =<?php echo $row["description"];?>;
        <?php
        }
        }?>
        }
 
    