title: Set the value of an html textfield with a php variable using echo
body: <p>I'm trying to grab a name from a database and then created a textfield with the value preset to that name.  I'm creating the textfield by echoing it out with php and setting the value to the name.  However the variable i put in the value is not running it's just printing out as {$c->prod_name} instead of the actual name.  </p>
  
  <p>Here is my query:</p>
  
  <pre><code>function name_id($id) {
      global $pdo;
  
      $stmt = $pdo-&gt;prepare("
          SELECT prod_name
          FROM products
          WHERE id = '$id'
          LIMIT 50");
  
      $stmt-&gt;execute();
  
      return $stmt-&gt;fetchAll( PDO::FETCH_OBJ );   
  }
  </code></pre>
  
  <p>Here is where i echo out the text field:</p>
  
  <pre><code>&lt;?php
  
      $name = name_id($id);
  
      foreach($name as $c){
  
          echo '&lt;input name="prod_name" type="text" size="50" value="{$c-&gt;prod_name}" ?&gt;';
  
      }
  
  ?&gt;
  </code></pre>