The problem is you aren't using the $_POST superglobal. The variables $name, $subject, $detail, etc are not defined. <input name="name ...> becomes $_POST['name'], etc.
You should always do some sanity checking with variables like this. Taking input from someone and putting directly into an...