title: How to echo mysql results to a text field
body: <p>this script displays data from a specific email address which the user enters.</p>
  
  <p>the snippet of code below displays the data in a textfield at the top of the page however I want to display the data in a textfield in the body of text.</p>
  
  <pre><code>echo '&lt;input name="login" type="text" value="' . $result['name'] . '&gt;';
  </code></pre>
  
  <p>What do  I change in the above code to enable me to do this.</p>
  
  <pre><code>&lt;?php
  
  $host=""; // Host name 
  $username=""; // Mysql username 
  $password=""; // Mysql password 
  $db_name=""; // Database name 
  $tbl_name="orders"; // Table name  
  
  $email = $_POST['textfield'];
  
  
          $db = new PDO('mysql:host='.$host.
                            ';dbname='.$db_name.
                            ';charset=UTF-8',
                      $username, $password);
          $stmt = $db-&gt;prepare('SELECT * FROM `orders` WHERE `email`=:email LIMIT 1');
          $stmt-&gt;bindValue(':email', $email, PDO::PARAM_STR);
          $stmt-&gt;execute();
          $result = $stmt-&gt;fetch(PDO::FETCH_ASSOC);
      if($stmt-&gt;rowCount()&gt;0)
  {
  echo '&lt;input name="login" type="text" value="' . $result['name'] . '&gt;';
  }
  else
  {
      echo "Email not found in the database!";
  }
  
  
    ?&gt;
  </code></pre>
  
  <p>form:</p>
  
  <pre><code>&lt;form id="form_53" name="login" action="test.php"&gt;
  
     &lt;input type="submit" value="Track"&gt;
     &lt;input type="text" username="textfield" value=""&gt;
     &lt;input type="text" name="name" value="&lt;?php echo $result['name']?&gt;"&gt; //I want to display results here
  
  &lt;/form&gt;
  </code></pre>