0

I'm using the following php script on a contact form but it is neither sending emails or redirecting -

<?php
  if (isset($_POST['submit'])) {
      $jobtype = $_POST['jobtype'];
      $name = $_POST['name'];
      $email = $_POST['email'];
      $message = $_POST['message'];
      
      $mailto = "myemail";
      $email_subject = "Contact form submission: $name";
      $email_body = "You have received a new message. ".
      " Here are the details:\n $jobtype \n Name: $name \n ".
      "Email: $email \n Message \n $message";
      
      mail($mailto, $email_subject, $email_body,);
      header("Location: thank-you.html?mailsend");
  }
  ?>  

The contact form is as follows -

  <form action="/contact.php" method="POST">
  
        <label for="jobtype">What can I do for you?</label>
      <select id="jobtype" name="jobtype">
        <option value="web-design">Web Design</option>
        <option value="logo-design">Logo Design</option>
        <option value="graphic-design">Graphic Design</option>
        <option value="photo-video">Photography/Video</option>
        <option value="general-enquiry">General Enquiry</option>
      </select>
      <label for="name">Who are you?</label>
      <input type="text" id="name" name="name" placeholder="Your name is..">
  
      <label for="email">Your email?</label>
      <input type="text" id="email" name="email" placeholder="Your email is..">
  
      <label for="message">A quick description of the job</label>
      <textarea id="message" name="message" placeholder="Let me know here.." style="height:200px"></textarea>
  
      <input type="submit" value="Submit">
    </form>

I've tried some of the fixes on here but none seem to work, any help is appreciated!

Rocon
  • 1
  • 1
  • Does this answer your question? [PHP mail function doesn't complete sending of e-mail](https://stackoverflow.com/questions/24644436/php-mail-function-doesnt-complete-sending-of-e-mail) – El_Vanja May 11 '21 at 13:23
  • _“I've tried some of the fixes on here but none seem to work”_ - what are we supposed to do with “information” like that? No one here knows _what_ you actually tried based on that, so no one knows what approaches would be pointless to suggest again now either. Don’t give us such statements, that are basically free of any _useful_ information. Please go read [ask]. – CBroe May 11 '21 at 13:34
  • Welcome to SO. What fixes have you tried, and what steps have you taken to debug your code? Are you getting any errors? – Connor Low May 11 '21 at 15:16

0 Answers0