0

I am trying to make a contact page but the form wont work. Here is a copy of both my html and php.

<body>
    <h1 id="title">Joerassic Park</h1>
    <div id="navt">
        <a href="index.html">Home</a> | <a href="about.html">About Me</a> | <a href="contact.html">Contact Me</a>
    </div>
    <div id="content">
        <center>
            <form action=”contact.php” method=”post”>
                Name: <input type=”text” name=”name”>
                <br /><br />
                Email: <input type=”text” name=”email”>
                <br /><br />
                Message:
                <br />
                <textarea name=”message” rows="10" cols="30"></textarea>
                <br /><br />
            <input type="submit" value="Submit">
            </form>
        </center>
    </div>
</body>

PHP:

    <html>
<body>
<?php
$to = “xyz@somedomain.com”;
$subject = “Contact Form”;
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$headers = “From: $email”;
$sent = mailto($to,$subject,$name,$message,$headers);
if($sent){
print('<a href=”contact.html”>Thank you. Click here to return to site.</a>')
}else{
print “There was an issue with your contact form”;
}
?>
</body>
</html>

The Goal is to have them fill out the form then have it email me directly the results.

JoerassicPark
  • 111
  • 1
  • 1
  • 6

1 Answers1

0

You have invalid double quotes:

    <html>
<body>
<?php
$to = “xyz@somedomain.com”;
$subject = “Contact Form”;
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$headers = “From: $email”;
$sent = mailto($to,$subject,$name,$message,$headers);
if($sent){
print('<a href=”contact.html”>Thank you. Click here to return to site.</a>')
}else{
print “There was an issue with your contact form”;
}
?>
</body>
</html>

should be:

    <html>
<body>
<?php
$to = "xyz@somedomain.com";
$subject = "Contact For";
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$headers = "From: $email";
$sent = mailto($to,$subject,$name,$message,$headers);
if($sent){
print('<a href="contact.html">Thank you. Click here to return to site.</a>')
}else{
print "There was an issue with your contact form";
}
?>
</body>
</html>
taxicala
  • 21,408
  • 7
  • 37
  • 66
  • I fixed the double quote and still get the issue. I get a 404 Not found: Not Found The requested URL /â€contact.php†was not found on this server. Apache/2.4.9 (Win64) PHP/5.5.12 Server at somedomain.net Port 80 I am using WAMP to host. – JoerassicPark May 21 '15 at 22:16
  • Replace all invalid double quotes with common double quotes in your HTML and you should be fine. – taxicala May 22 '15 at 12:38