Studiati questo codice:

Codice PHP:
<?php

$nome 
= isset($_POST['nome']) ? $_POST['nome'] : '';
$nome get_magic_quotes_gpc() ? stripslashes($nome) : $nome;

$html sprintf('<input type="text" name="nome" value="%s" />'htmlentities($nomeENT_QUOTES));

$sql sprintf('SELECT * FROM table WHERE nome = "%s"'mysql_real_escape_string($nome));

?>