Am si eu o problema cu un formular de contact. Te rog daca ma poti ajuta si pe mine.
Problema mea e urmatoarea.
Formularul de contact arata cam asa:
Cod formular de contact:
Cod: Selectaţi tot
<div class="col-md-10 col-md-offset-1 animate-box">
<h3>Formular de contact</h3>
<form action="#">
<div class="row form-group">
<div class="col-md-6">
<label for="name">Nume</label>
<input type="text" id="name" class="form-control" placeholder="Introduceti numele">
</div>
<div class="col-md-6">
<label for="number">Telefon</label>
<input type="text" id="number" class="form-control" placeholder="Introduceti nr telefon pentru contact">
</div>
</div>
<div class="row form-group">
<div class="col-md-12">
<label for="email">Adresa e-mail</label>
<input type="text" id="email" class="form-control" placeholder="Introduceti adresa de email">
</div>
</div>
<div class="row form-group">
<div class="col-md-12">
<label for="subject">Subiect</label>
<input type="text" id="subject" class="form-control" placeholder="Introduceti subiectul mesajului">
</div>
</div>
<div class="row form-group">
<div class="col-md-12">
<label for="message">Mesaj</label>
<textarea name="message" id="message" cols="30" rows="10" class="form-control" placeholder="Introduceti mesajul"></textarea>
</div>
</div>
<div class="form-group text-center">
<input type="submit" value="Trimite mesaj" class="btn btn-primary">
</div>
</form>
</div>
</div>
</div>
</div>
<!--================Contact Success and Error message Area =================-->
<div id="success" class="modal modal-message fade" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<i class="fa fa-close"></i> </button>
<h2>Va multumim</h2>
<p>Mesajul dvs. a fost trimis cu succes catre Hotel Albatros.</p>
<p>In scurt timp veti fi contactat de catre personalul nostru.</p>
</div>
</div>
</div>
</div>
<!-- Modals error -->
<div id="error" class="modal modal-message fade" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<i class="fa fa-close"></i> </button>
<h2>Ne cerem scuze !</h2>
<p> Mesajul dvs. nu a fost trimis. Va rugam reincercati. </p>
</div>
</div>
</div>
</div>
Cod: Selectaţi tot
<?php
$to = "adresamea@domeniu.ro";
$from = $_REQUEST['email'];
$name = $_REQUEST['name'];
$subject = $_REQUEST['subject'];
$number = $_REQUEST['number'];
$cmessage = $_REQUEST['message'];
$headers = "From: $from";
$headers = "From: " . $from . "\r\n";
$headers .= "Reply-To: ". $from . "\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$subject = "Aveti un mesaj nou de la site-ul dvs.";
$body = "<!DOCTYPE html><html lang='en'><head><meta charset='UTF-8'><title>Express Mail</title></head><body>";
$body .= "<table style='width: 100%;'>";
$body .= "<thead style='text-align: center;'><tr><td style='border:none;' colspan='2'>";
$body .= "<a href='{$link}'><img src='{$logo}' alt=''></a><br><br>";
$body .= "</td></tr></thead><tbody><tr>";
$body .= "<td style='border:none;'><strong>Nume:</strong> {$name}</td>";
$body .= "<td style='border:none;'><strong>Email:</strong> {$from}</td>";
$body .= "</tr>";
$body .= "<tr><td style='border:none;'><strong>Subiect:</strong> {$csubject}</td></tr>";
$body .= "<tr><td></td></tr>";
$body .= "<tr><td colspan='2' style='border:none;'>{$cmessage}</td></tr>";
$body .= "</tbody></table>";
$body .= "</body></html>";
$send = mail($to, $subject, $body, $headers);
Multumesc in avans