title: Return data from php file to html
body: <p>I am attempting to pass data between a php file back to a HTML file. I read on stack overflow that I should use AJAX or JQuery but i don't understand how to implement it (I am very new to the subject of web development so I apologize if this question is obvious). Any help would be much appreciated.</p>
  
  <p>This is my HTML code:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  
  &lt;head&gt;
  &lt;style&gt;
  body {background-color: powderblue;}
  
  #head_canvas {
      width: 50;
      height: 20;
      border: 1px solid black;
      margin: 0px auto;
      text-align: center;
  }
  
  &lt;/style&gt;
  &lt;/head&gt;
  
  &lt;div style="margin:0 auto" align=center&gt;
  
      &lt;canvas id="head_canvas" width="1400" height="90"&gt;Your browser does not support the HTML5 canvas tag.&lt;/canvas&gt;
  
      &lt;form action="form_submit.php" method="post"&gt;
          &lt;strong&gt;Search: &lt;/strong&gt;&lt;input type="text" name="search"&gt;
  
          &lt;input type="submit" value="Submit" &gt;
      &lt;/form&gt;
  
  
  &lt;/div&gt;
  
  
  &lt;body&gt;
  
  
  
  &lt;script&gt;
  // Create the initial Header Box 
  var c = document.getElementById("head_canvas");
  var ctx = c.getContext("2d");
  
  var my_gradient=ctx.createLinearGradient(0,0,0,95);
  my_gradient.addColorStop(0,"DarkOrchid");
  my_gradient.addColorStop(1,"white");
  
  ctx.font="30px Verdana";
  ctx.fillStyle=my_gradient;
  ctx.fillRect(0,0,1400,90);
  
  ctx.textAlign = "center";
  ctx.fillStyle = "#000"
  ctx.fillText("Product Search", 700, 50);
  &lt;/script&gt;
  
  
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>And this is my PHP code:</p>
  
  <pre><code>&lt;html&gt;
  
      &lt;head&gt;
          &lt;title&gt;Get Data&lt;/title&gt;
      &lt;/head&gt;
  
      &lt;body&gt;
  
          &lt;?php
  
              $dbhost = 'localhost';
              $conn = mysql_connect($dbhost, 'username', 'password');
              if (!$conn) {
                  die('Could not connect: ' . mysql_error());
              }
              else {
                  echo "Successfully Connected To Database&lt;br&gt;";
              }
  
              /*
              INSERT INTO Members (MemberID, Pass, UserName) VALUES (1,'MyPas55w0rd','Johnny Bravo');
              */
  
              mysql_select_db("mydb",$conn);
              $sql="SELECT * FROM Members;";
              $result=mysql_query($sql);
  
              while($rows=mysql_fetch_array($result,MYSQL_ASSOC)){
                  #echo $rows['MemberID'] . " , " . $rows['Pass'] . " , " . $rows['UserName'] . "&lt;br&gt;";
                  echo array_values($rows)[1] . "&lt;br&gt;";
              }
  
              mysql_close();
  
          header('Location: index.html');
          exit;
          ?&gt;
  
      &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>