Q:

how to insert php on html5

I wanted to insert php on html5
i trying copy code from  w3schools 
<!DOCTYPE html>
<html lang = "en-US">
 <head>
 <meta charset = "UTF-8">
 </head>
 <body>
    <div id="result"> </div> 

  <script>
if(typeof(EventSource) !== "undefined") {
    var source = new EventSource("do_dropdown.php");
    source.onmessage = function(event) {
        document.getElementById("result").innerHTML += event.data + "<br>";
    };
} else {
    document.getElementById("result").innerHTML = "Sorry, your browser does not support server-sent events...";
}
</script>
 </body>
</html>

my do_dropdown.php  just select data from drop down list

but it doesn't show anything.
what do i miss?

A:

the right thing to do, for my opinion
is to send your options data as JSON and to parse it with JS to required dropdown
for easy solution that will fit your situation, ill assume this is your PHP code:
//file name: do_dropdown.php
<?php
  $options = [1,2,3,4,5];
  echo '<select name="name">';
  foreach $options as $option{
     echo "<option value=$option>$option</option>";
  }
  echo '</select>';
?>

so you need to change your html file to PHP file (file.html -> file.php) and make sure you run on it PHP server (localhost as you are using right now)
<div id="result">
  <?php
    require_once "do_dropdown.php";
  ?>
</div>

there  are much better solutions for this, but I guess your'e new in business so good luck :)

