Can't get on-the-fly select box to work

Can't get on-the-fly select box to work

If you look at source code produced in web developer tools you see the following, however, it is all in one long string. It never shows up on the screen. Don't know how to fix. Help.

<h2>Pick A Database to Restore.</h2> 

<form id='frm1' action='' method='post'>
<select id='mySelect' name='DBase'>

<option value=''>
<option value='1'>
<option value='2'>
<option value='3'>2020Sep18-13:31:43_accounts.sql</option>
<option value='4'>2020Oct13-13:17:01_accounts.sql</option>
<option value='5'>2020Oct13-13:16:03_accounts.sql</option>
<option value='6'>

<input type='submit' name='submit' value='Get DataBase' >

  1. <?php

    // restoreBackup.php  pick a database to restore into MySql ...

    include './include/';

    ini_set("display_errors", true);

       $hostname = "localhost";
       $database = "accounts";
       $username = "rick";
       $passwd = "pwd";

    //echo getcwd(); exit();

    // Open the directory, and read its contents
    if (is_dir($directory)){
      if ($fh = opendir($directory)){
        while (($file = readdir($fh)) !== false){
            if($file=="." || $file=="..") {continue;}
            //echo $file;

    //  ==================================================================================
    //  Need function here to abort and go back to index.html if no databases in bakup file
    //  ===================================================================================

    <!DOCTYPE html >

            <title>restoreBakup.php 15Oct2020 </title>
            <meta http-equiv="content-type" content="text/html; charset=UTF-8" />

                <script  type="text/javascript" src="./jquery/jquery-1.9.1.js"> </script>


    <div id="selectFile" >


    <h2>Pick A Database to Restore.</h2>


    echo "<form id='frm1' action='' method='post'>";
    echo "<select id='mySelect'  name='DBase'>"
    echo "<option value=''>Select...</option>";

        for($i=0; $i<count($pickFile); $i++) {       
          echo "<option value='".($i+1)."'>".$pickFile[$i]."</option>";

    echo "<select>";

    echo "<input type='submit' name='submit' value='Get DataBase' >";

    echo "</form>";


    <script type="text/javascript" >


    <script type="text/javascript" >

    var choice="";
    var database="accounts";

    $(function() {              // BELOW - on submit do the following
    $("#frm1").submit(function(event ) {
        alert("Inside submit()");                        // NEVER HAPPENS
          choice=$("#mySelect option:selected").text();
           // ================== 1st & Only Call to Ajax() ========================

    var request = $.ajax({
        url: "restoreMySql.php",
        type: "GET",
        data: { "pwd": "pwd", "db": choice},
        dataType: "text" ,
            success: (function(retval) {
                if (retval=='ok') {
                } else {
                   alert(" Restoring MySql "+database+" ... Was not successful.");
                } // else    
            }) // success from 1st call    
    }) // end ajax-1
, textStatus ) {
           alert("go see firebug");
            document.write("Request failed: " + textStatus );   
     // ===========  End 1st Call ============