0

I am trying to create a working PHP contact form on my website and whenever I fill out the boxes and click submit it takes me to this link.

What happens when I click submit on my website

enter image description here

Here is the relevant HTML

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

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

    <label for="lname">Last Name*</label>
    <input type="text" id="lname" name="lastname" placeholder="Your last name..." required>

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

    <label for="cqc">Your Comment, Quesetion, or Concern*</label>
    <select id="cqc" name="cqc">
        <option selected="selected" value="select_one" disabled>Select One</option>
        <option value="order_status">Order Status</option>
        <option value="order_cancellation">Order Cancellation</option>
        <option value="volunteer_opportunities">Volunteer Opportunities</option>
        <option value="feedback">Feedback</option>
        <option value="other">Other</option>
    </select>

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

    <input type="submit" value="Submit"><input type="reset" value="Clear">

    <p1>
        <br>
        <br>
        * Is a required field
    </p1>
  </form>
</div>

and PHP

<? php $fname = $_POST['First Name']
$lname = $_POST['Last Name']
$email = $_POST['Email']
$cqc = $_POST['Question, Comment, or Concern']
$message = $_POST['Message']
$formcontent = "From: $name \n Message: $message";
$recipient = "info@create-a-cloth.com";
$subject = "Contact Form Message";
$mailheader = "From: $email \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Sorry,    there was an error with the information you provided. Please double check to    make sure everything is right.";
echo "Thank you for contacting us! We will respond to you as soon as     possible!" . " -" . "<a href='header.html' style='text-    decoration:none;color:#ff0099;'> Return Home</a>";
?>
John Conde
  • 217,595
  • 99
  • 455
  • 496

0 Answers0