2019-03-22 03:12
浏览 71


I have a contact form that I would like to send to my email address at my domain. However, upon hitting the "Submit" button, the website gets redirected to the .PHP url where it gives me:

HTTP ERROR 500: This page isn’t working "mywebsite.com" is currently unable to handle this request.

No email is received and the header("Location: ") doesn't redirect. I am currently using Bluehost. You can find the form I'm working on at acromojo.com/contact. I haven't added security yet, just trying to get the form to work first.

What am I doing wrong?


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

    <div><select name="projectType">
      <option value="0">Start A Project</option>
      <option value="1">General Inquiry</option>
      <option value="2">Collaborating</option>
    <input name="name" type="text" placeholder="Full Name" required>
    <input name="company" type="text" placeholder="Company / Organization"></br>
    <input name="phone" type="phone" placeholder="Phone Number" required>
    <input name="email" type="email" placeholder="Email Address"></br>
    <input name="location" type="text" placeholder="Location">
    <select name="find">
      <option value="0">How did you hear about us?</option>
      <option value="1">Social Media</option>
      <option value="2">Search Engine</option>
      <option value="3">Referrals / Recommendations</option>
      <option value="4">Other</option>
    <textarea name="message" placeholder="Please tell us a little about your project, timeline, and budget" row="4" required></textarea></br>
    <label>Sign me up for the latest news, events, and more
      <input name="newsletter" type="checkbox" checked="checked">
      <span class="checkmark"></span>
        <input type="submit" name="submit" value="SUBMIT">





    $name = $_POST['name'];
    $subject = $_POST['projectType'];
    $phone = $_POST['phone'];
    $email = $_POST['email'];
    $location = $_POST['location'];
    $find = $_POST['find'];
    $message = $_POST['message'];
    $newsletter = $_POST['newsletter'];

    $headers = "From: $email";
    $txt = "You have received an e-mail from ".$name."

      "Location: ".$location."
      "Contact: ".$phone.", ".$email."
      "Found from: ".$find."


    mail("hello@acromojo.com", $subject, $txt, $headers);
    header("Location: contact.html?mailsent");
  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

相关推荐 更多相似问题