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.
Here is my query:
function name_id($id) {
global $pdo;
$stmt = $pdo->prepare("
SELECT prod_name
FROM products
WHERE id = '$id'
LIMIT 50");
$stmt->execute();
return $stmt->fetchAll( PDO::FETCH_OBJ );
}
Here is where i echo out the text field:
<?php
$name = name_id($id);
foreach($name as $c){
echo '<input name="prod_name" type="text" size="50" value="{$c->prod_name}" ?>';
}
?>