Copy link to clipboard
Copied
Hi all... I am graphic designer that is new to web design and am trying to create and email contact form on my website, however when i ftp upload and try to use the form it comes up with the following error - I have gone through a number of tutorials on the internet and nothing seems to fix this problem - can anyone help?-
is currently unable to handle this request.
...here is the code...
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>contactform</title>
</head>
<body>
<?php
if (isset($_POST['submit'])){
$name=$_POST['name'];
$email=$_POST['email'];
$phone=$_POST['phone'];
$comment=$_POST['comment'];
$subject='New Message';
$message="Name: ".$name."\n"."Phone: ".$phone."\n". "Wrote the following: "."\n\n".$comment;
$headers="From: ".$email;
if (mail($to, $subject, $comment, $headers)){
echo "Your Message has been sent"." ".$name.", We will contact you shortly!";
}
else{
echo "Something went wrong!";
}
}
?>
</body>
</html>
html code...
<div id="formwrapper">
<form action="contactform.php" method="post" name="form1" id="form1">
<p>
<span class="bodytextGrey">Full Name
</span>
<input name="name" type="text" required class="formstyle" id="name" form="form1" size="30">
</p>
<p>
<label for="email" class="bodytextGrey">Email*</label>
<input name="email" type="email" required class="formstyle" id="email" form="form1" size="34">
</p>
<p>
<label for="phone" class="bodytextGrey">Contact No. </label>
<input name="phone" type="tel" required class="formstyle" id="phone" form="form1" size="29">
</p>
<p>
<label for="comment"><span class="bodytextGrey">Comments</span><br>
</label>
<textarea name="comment" cols="53" rows="10" id="comment" form="form1"></textarea>
<label for="textfield2"> <br>
</label>
</p>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td align="center"><input name="submit" type="submit" class="submitbutton" id="submit" form="form1" formaction="form_process.php" formmethod="POST" value="Submit"></td>
</tr>
</tbody>
</table>
<p> </p>
</form>
</div>
Copy link to clipboard
Copied
I think that your submit button contains erroneous code like the formaction which is different to action in the form element. I also think that security is going to be an issue if you persue with your code.
Have a look at what Nancy suggests at Alt-Web Design & Publishing: Responsive Contact Form with Bootstrap 3.2 and PHP (Part 1). Please ignore the Bootstrap stuff if you are not using it. Just read the article and take note of the PHP code.
Copy link to clipboard
Copied
Thank you, Ben...I will go check this out and see how i go. Cheers.