I am trying to get a submit form working but I think I might be missing something - either that or it might not be working because the website isn't live.
This is the form part of the webpage.
<div class="contact">
<div id="contact_form">
<form name="form1" id="ff" method="post" action="contact.php">
<label>
<span>Enter your name:</span>
<input type="text" name="name" id="name" required>
</label>
<label>
<span>Enter your phone number:</span>
<input type="text" name="phone" id="phone" required>
</label>
<label>
<span>Enter your email:</span>
<input type="email" name="email" id="email" required>
</label>
<label>
<span>Your message here:</span>
<textarea name="message" id="message"></textarea>
</label>
<center><input class="sendButton" type="submit" name="Submit" value="Submit"></center>
</form>
</div>
</div>
And here is the php I am using.
<?php
$text = "<span style='color:red;'>Error! Please try again.</span>";
if(isset($_POST['name']))
{
$name=$_POST['name'];
$phone=$_POST['phone']
$email=$_POST['email'];
$message=$_POST['message'];
$to = "enquiries@website.com";
$subject = "Web Enquiry Submission";
$message = " Name: " . $name ."\r\n Phone: " . $phone ."\r\n Email: " . $email . "\r\n Message:\r\n" . $message;
$from = "**Not_Sure_What_Goes_Here**";
$headers = "From:" . $from . "\r\n";
$headers .= "Content-type: text/plain; charset=UTF-8" . "\r\n";
if(@mail($to,$subject,$message,$headers))
{
$text = "<span style='color:blue;'>Your Message was sent successfully !</span>";
}
}
?>
Any help would be appreciated.
Cheers.
Aucun commentaire:
Enregistrer un commentaire