This is the code for my form
<form name="contactform" method="post" action="sentfrommail.php">
<h1 style="color: #000; font-size:18px; text-decoration:underline; text-align:left; padding-bottom:5px;"> Personal Details</h1>
<table width="90%" border="0">
<tr>
<td width="40%"><label for="name"> <span class="colored">*</span>Mr./Ms./Mrs.</label></td>
<td width="60%"><input type="text" name="name" maxlength="50" size="40%"></td>
</tr>
<tr>
<td><label for="name"><span class="colored">*</span>Designation:</label></td>
<td><input type="text" name="desg" maxlength="50" size="40%"></td>
</tr>
<tr>
<td><label for="name"><span class="colored">*</span>Company Name:</label></td>
<td><input type="text" name="compname" maxlength="50" size="40%"></td>
</tr>
<tr>
<td><label for="name"><span class="colored">*</span>Address:</label></td>
<td> <textarea name="address" maxlength="1000" cols="42" rows="2"></textarea></td>
</tr>
<tr>
<td><label for="name"><span class="colored">*</span>Email:</label></td>
<td><input type="text" name="email" maxlength="80" size="40%"></td>
</tr>
</table>
<div class="center" style="padding-left:20%; padding-top:4%;">
<button class="button2" name="submit" type="submit" value="Submit"><span>Send Message</span></button>
</div>
</form>
The sentfrommail.php is given below
<?php
$EmailFrom = "mymail@site.com";
$EmailTo = "editor@mysite.com";
$Subject = "New Enquiry";
$name = Trim(stripslashes($_POST['name']));
$desg = Trim(stripslashes($_POST['desg']));
$compname = Trim(stripslashes($_POST['compname']));
$address = Trim(stripslashes($_POST['address']));
$email = Trim(stripslashes($_POST['email']));
// validation
$validationOK=true;
if (!$validationOK) {
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
exit;
}
// prepare email body text
$Body = "";
$Body .= "Name: ";
$Body .= $name;
$Body .= "\n";
$Body .= "Designation: ";
$Body .= $desg;
$Body .= "\n";
$Body .= "Company Name: ";
$Body .= $compname;
$Body .= "\n";
$Body .= "Email: ";
$Body .= $email;
$Body .= "\n";
$Body .= "Address: ";
$Body .= $address;
$Body .= "\n";
$Body .= "\n";
// send email
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");
// redirect to success page
if ($success){
print "<meta http-equiv=\"refresh\" content=\"0;URL=contactthanks.php\">";
}
else{
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
}
?>
The form is not submitting. Its showing the 404 page not found error. What Am I doing wrong?
i also used this method
<?PHP
/*
Contact Form from HTML Form Guide
This program is free software published under the
terms of the GNU Lesser General Public License.
See this page for more info:
*/
require_once("http://www.example.com/include/fgcontactform.php");
$formproc = new FGContactForm();
//1. Add your email address here.
//You can add more than one receipients.
$formproc->AddRecipient('editor@mysite.com'); //<<---Put your email address here
//2. For better security. Get a random tring from this link:
// and put it here
$formproc->SetFormRandomKey('CnRrspl1FyEylUj');
if(isset($_POST['submitted']))
{
if($formproc->ProcessForm())
{
$formproc->RedirectToURL("thank-you.php");
}
}
?>
and the fgcontactform.php includes phpmailer. still getting the page not found error Thank You