0

I am fairly new to coding and am having an issue with my website contact form. It won't allow me to receive email when the form is filled and submit button clicked. I know nothing about PHP and it's obvious something is missing or incorrect. I've included only the relevant portions of the file...thanks for any help I can get!

<div id="page_4"> 
 <div id="wrapper">    
   <form action="contact form.php" method="post">
  <label for="fname">Name</label>
  <input type="text" name="name" placeholder="Full name...">
  <label for="email">Email</label>
  <input type="text" name="email" placeholder="...">
  <label for="phone">Phone</label>
  <input type="text" name="phone" placeholder="...">
  <label for="subject">Subject</label>
  <input type="text" name="subject" placeholder="..."> 
  <label for="detail">Project Detail</label>
  <textarea name="detail" placeholder="Please use detail if possible..." style="height:200px"></textarea>
  <label for="deadline">Project Deadline (MO/DY/YR)</label>
  <input type="text" name="deadline" placeholder="..."> 
  <a href="mailto:mark@markabove.com"><input type="submit" value="Submit"></a>
   </form>
 </div>
</div>        

<?php
 
if (isset($_POST['submit'])) {
 
$name = $_POST['name']; 
$subject = $_POST['subject']; 
$mailfrom = $_POST['mail']; 
$message = $_POST['message']; 
 
$mailTo = "mark@markabove.com"; 
$headers = "From: ".$mailFrom;
$txt = "You have recieved an e-mail from ".$name."\n\n".$message; 
 
mail($mailTo, $subject, $txt, $headers);
header("Location: contact.html?mailsend"); 
 
}
 
?> 
  • Look at `` and `if (isset($_POST['submit'])) {`. Hint `name`(Also not sure what the behavior of a link around a submit does, never seen that before) – user3783243 Dec 01 '18 at 02:06

1 Answers1

-1

The URL for the form action tag has a space in it. Perhaps change it to contact-form.php.

Witnauer
  • 19
  • 4