First, you’ve got a ` in your code and second, you forgot a semicolon on the second line. Use a source code editor with syntax highlighting to spot the syntax errors.
<?php
echo $_POST["fname"];
$handler= fopen('f.txt', 'a');
$data=$_POST["fname"];
fwrite($handle,$data);
?>
solved PHP $_POST syntax error [closed]