I am using form's input field, which is using a datalist as its source. Datalist consist of 2 fields:

  1. Score (of a person)
  2. Name (of that person)


On typing the name, datalist is working correctly with the submit button. But, when I click on the person name, it shows the score of that person. But, I want to display the author name and want to preserve the author score.

Little progress so far. Only a constant string from the JavaScript function is successfully passed and easily able to print in the data field. Unfortunately, when the author name is passed, it failed. Following message appeared in the input box:
HTML Code:
undefined"): onselect="myFunction(<?php echo $authorlast;?>)
Also, when a constant string is passed. The output in Score field was unbelievable.
I want to modified the code, so that it should display the 'selected name rather than the score' and score should be preserved.

HTML Code:
<form method="post" action="XYZ.php">
            Name: <input list="scoreandnamelist" name="namevar" id="correctanswer" onselect="myFunction('constantString')" style="width: 20em; font-size:16pt;" autofocus >
        <datalist id="scoreandnamelist"> &nbsp &nbsp &nbsp 
		.
		PHP code
		.
        </datalist> 
            <input type='hidden' name='maincontent' value='execution'><br><br>
            <input type="submit" value= "Submit">
        </form>
    <script>
        function displayscoreandname(inputtext) 
        {
            var score= document.getElementById("correctanswer").value;
            document.getElementById("correctanswer").value = inputtext;
            alert (score);
        }       
    </script> 
Problem 2: script code is displaying random data

Previously, everything was correct, but when I tried to insert Google map API on the directory page of client website. Most of the pages were parsed properly, but when I try to access south-east region pages they are showing random combination of greek and xml letters in the map region with error saying 'sync issue: contact your hosting company'. Example, if a Texas base is accessed: http://militarybases.co/directory/la...an-antonio-tx/, it is converting showing the error (mentioned previously). I am confused, if the issue was with sync, the problem should be common in all the directory pages? Or all the pages should work perfectly.