Prova con:

Codice PHP:
<html>
<head>
<?php
if (isset($_POST['inviato'])) {
echo(
"Il seguente nome &egrave; stato");
echo(
" immesso: " . @$_POST['nm'] . " " . @$_POST['cg'] . "

"
);
}
?>
</head>
<body>
Digitate un nome e inviate il form:
<form action="prova.php" method = "post">
  <input name="cg" />
  cognome

  <input name="nm" />
  nome

  <input type="submit" name="inviato"/>
  <input type="reset" />
</form>
</body>
</html>
E leggiti la seguente pagina di manuale:

http://www.php.net/manual/it/tutorial.forms.php