<?php

mb_internal_encoding('utf-8');
error_reporting(-1);

$name = $_POST['name'];
$db = new PDO("mysql:host = localhost;dbname = test", "root", "");
$sth = $db->prepare("INSERT into foo SET ( name = $name )");
$sth->bindParam(':name', $name);
$sth->execute();

?>