Solution 1 :

if (isset($_POST['submit']))

that will never be true, change it to any other field. name,email, city, message

Problem :

I don’t know much PHP but I used a tutorial to connect my contact form to my email. Below is my html contact form, and the PHP file I wrote:

<form name="contactform" method="post" action="mail.php">

 <label for="fname">Name</label>
 <input type="text" id="fname" name="name" placeholder="Your name..">

 <label for="email">Email</label>
 <input type="text" id="email" name="email" placeholder="Your email address">

 <label for="city">City</label>
 <input type="text" id="city" name="city" placeholder="Your city">

 <label for="message">Message</label> 
 <textarea id="message" name="message" placeholder="Write something.." style="height:170px"> 

 <input type="submit" value="Submit" name="submit">


if (isset($_POST['submit'])){
$name = $_POST['name']; 
$mailFrom= $_POST['email']; 
$city = $_POST['city']; 
$message = $_POST['message'];  

$mailTo = "(insert my email here)";
$headers = "From: ".$mailFrom;
$txt = "You received an e-mail from ".$name.".nn"

mail($mailTo, $txt, $headers);
header("Location: " contact.html?mailsend");




Comment posted by Don’t Panic

Looks like a parse error in your PHP.

Comment posted by Don’t Panic

Why wouldn’t it be true? I must have missed something

Comment posted by SierraOscar

The form has an input control with the name