Click here to Skip to main content
15,886,065 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
THE HTML

<div class="col-md-6">

	<form class="contact-form" id="contactForm" action="php/contact.php" method="post">

		<div class="form-group">
			<input class="form-control" name="name" id="name" placeholder="Full Name" type="text" required="required" />
		</div>

		<div class="form-group">
			<input class="form-control" type="email" name="email" id="email" placeholder="Email Address" required="required" />
		</div>

		<div class="form-group">
			<input class="form-control" placeholder="Subject" type="text" id="subject" name="subject">
		</div>

		<div class="form-group">
			<textarea class="form-control" name="message" id="message" placeholder="Message" rows="5"></textarea>
		</div>

		<button class="btn btn-default btn-lg btn-block" id="js-contact-btn">Send message</button>
	</form>

	<div id="js-contact-result" data-success-msg="Form submitted successfully." data-error-msg="Oops. Something went wrong."></div>

</div>



The PHP

<?php

/*
 * ------------------------------------
 * Contact Form Configuration
 * ------------------------------------
 */
 
$to    = "test@surjithctly.in"; // <--- Your email ID here


/*
 * ------------------------------------
 * END CONFIGURATION
 * ------------------------------------
 */
 
$name     = $_REQUEST["name"];
$email    = $_REQUEST["email"];
$subject  = $_REQUEST["subject"];
$msg      = $_REQUEST["message"];

if (isset($email) && isset($name)) {
     
  $website = "http://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; 
    $headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
$headers .= "From: ".$name." <".$email.">\r\n"."Reply-To: ".$email."\r\n" ;
$msg     = "Hello Admin, <br/> <br/> You've got a message from $name ($email)<br/><br/>Message: $msg <br><br> -- <br>This e-mail was sent from a contact form on $website";
  
   $mail =  mail($to, $subject, $msg, $headers);
  if($mail)
  {
    echo 'success';
  }

else
  {
    echo 'failed';
  }
}

?>


What I have tried:

i have tried edit as much as i can i change the action in html as localhost/php/contact.php.

i also tried changes in php changing $request to $post.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900