Here is my code, when i click submit doesn´t show me error or success message I changed the names of the variables inside de PHP and in the HTML as well but it doesn´t work. i don´t now why isn´t working.
<?php
if(isset($_POST['submit']))
{
$name = $_POST['name']; // Get Name value from HTML Form
$email_id = $_POST['email']; // Get Email Value
$mobile_no = $_POST['mobile']; // Get Mobile No
$msg = $_POST['message']; // Get Message Value
$to = "info@hokana.com.mx"; // You can change here your Email
$subject = "'$name' has been sent a mail"; // This is your subject
// HTML Message Starts here
$message ="
<html>
<body>
<table style='width:600px;'>
<tbody>
<tr>
<td style='width:150px'><strong>Name: </strong></td>
<td style='width:400px'>$name</td>
</tr>
<tr>
<td style='width:150px'><strong>Email ID: </strong></td>
<td style='width:400px'>$email_id</td>
</tr>
<tr>
<td style='width:150px'><strong>Mobile No: </strong></td>
<td style='width:400px'>$mobile_no</td>
</tr>
<tr>
<td style='width:150px'><strong>Message: </strong></td>
<td style='width:400px'>$msg</td>
</tr>
</tbody>
</table>
</body>
</html>
";
// HTML Message Ends here
// Always set content-type when sending HTML email
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
if(mail($to,$subject,$message,$headers)){
// Message if mail has been sent
echo "<script>
alert('Mail has been sent Successfully.');
</script>";
}
else{
// Message if mail has been not sent
echo "<script>
alert('EMAIL FAILED');
</script>";
}
}
?>
<!DOCTYPE html>
<html lang="en">
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<head>
<meta charset="utf-8">
<meta content="width=device-width, initial-scale=1.0" name="viewport">
<title>Hokana MD</title>
<meta content="" name="descriptison">
<meta content="" name="keywords">
<!-- Favicons -->
<link href="assets/img/icono.png" rel="icon">
<link href="assets/img/apple-touch-icon.png" rel="apple-touch-icon">
<!-- Google Fonts -->
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i,700,700i|Roboto:300,300i,400,400i,500,500i,700,700i&display=swap" rel="stylesheet">
<!-- Vendor CSS Files -->
<link href="assets/vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link href="assets/vendor/animate.css/animate.min.css" rel="stylesheet">
<link href="assets/vendor/icofont/icofont.min.css" rel="stylesheet">
<link href="assets/vendor/boxicons/css/boxicons.min.css" rel="stylesheet">
<link href="assets/vendor/venobox/venobox.css" rel="stylesheet">
<link href="assets/vendor/owl.carousel/assets/owl.carousel.min.css" rel="stylesheet">
<link href="assets/vendor/aos/aos.css" rel="stylesheet">
<!-- Template Main CSS File -->
<link href="assets/css/style.css" rel="stylesheet">
</head>
<body>
<main id="main">
<!-- ======= Contact Section ======= -->
<section class="breadcrumbs">
<div class="container">
<div class="d-flex justify-content-between align-items-center">
<h2>Contacto</h2>
<ol>
<li><a href="index.html">Inicio</a></li>
<li>Contacto</li>
</ol>
</div>
</div>
</section><!-- End Contact Section -->
<!-- ======= Contact Section ======= -->
<section class="contact" data-aos="fade-up" data-aos-easing="ease-in-out" data-aos-duration="500">
<div class="container">
<div class="row">
<div class="col-lg-6">
<div class="row">
<div class="col-md-6">
<div class="info-box">
<i class="bx bx-envelope"></i>
<h3>Mandanos un correo</h3>
<p></p>
</div>
</div>
<div class="col-md-6">
<div class="info-box">
<i class="bx bx-phone-call"></i>
<h3>Llamanos</h3>
<p></p>
</div>
</div>
</div>
</div>
<div class="col-lg-6">
<form role="form" action="submit.php" method="post">
<div class="form-row">
<div class="col-md-6 form-group">
<input name="name" style="border:3px; border-style:inset; height: 1cm;" required="required" type="text" placeholder="Nombre" size="20"/>
</div>
<div class="col-md-6 form-group">
<input name="email" style="border:3px; border-style:inset; height: 1cm;" required="required" type="email" placeholder="Correo de contacto"/>
</div>
</div>
<div class="form-group">
<input name="mobile" style="border:3px; border-style:inset; height: 1cm;" required="required" type="text" placeholder="Numero de contacto"/>
</div>
<div class="form-group">
<textarea name="message" style="border:3px; border-style:inset;" placeholder="Mensaje" cols="56"></textarea>
</div>
<br>
<div class="text-center"><button style="border:3px; border-style:inset; height: 1cm;" rows="5" type="submit" value="send">Enviar</button></div> </form>
</div>
</div>
</div>
</section><!-- End Contact Section -->
</main><!-- End #main -->
<a href="#" class="back-to-top"><i class="icofont-simple-up"></i></a>
<!-- Vendor JS Files -->
<script src="assets/vendor/jquery/jquery.min.js"></script>
<script src="assets/vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
<script src="assets/vendor/jquery.easing/jquery.easing.min.js"></script>
<script src="assets/vendor/php-email-form/validate.js"></script>
<script src="assets/vendor/venobox/venobox.min.js"></script>
<script src="assets/vendor/waypoints/jquery.waypoints.min.js"></script>
<script src="assets/vendor/counterup/counterup.min.js"></script>
<script src="assets/vendor/owl.carousel/owl.carousel.min.js"></script>
<script src="assets/vendor/isotope-layout/isotope.pkgd.min.js"></script>
<script src="assets/vendor/aos/aos.js"></script>
<!-- Template Main JS File -->
<script src="assets/js/main.js"></script>
</body>
</html>
Aucun commentaire:
Enregistrer un commentaire