0

I've scoured SOF and google for an answer no joy I am able to connect to a database I presume in JavaScript, I wish to populate the results into a HTML forms option field.

<script type="text/javascript">
function gao(){
var An;

$sql = "SELECT * FROM Anouncements";
//  Execute the query

$result = mysqli_query($conn, $sql);

if (mysqli_num_rows($result) > 0) {
// output data of each row
while($row = mysqli_fetch_assoc($result)){
an=$result[1];         
return(an);
   }
}
</script>
<head>
<body>
  <form action="javascript:gao(s1)"/>  
    <select name="num" id="s1" required>
        <option value="1">gao</option>
    </select>   
  </form>
Mi-Creativity
  • 9,554
  • 10
  • 38
  • 47
Data
  • 113
  • 2
  • 11
  • are you looking for adding option to select using javascript then its duplicate of http://stackoverflow.com/questions/8674618/adding-options-to-select-with-javascript – Anil Feb 11 '16 at 03:29
  • Thanks for the reply "mi-creativity" my code calls a suposidly calls a function with the line I have a function(which is not called) named gao all Iam left with is a single option gao, How to make it work!!!?????? – Data Feb 11 '16 at 10:34

0 Answers0