Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!-- contacto-->
- <section class="contact" id="contact">
- <h1>Contacto</h1>
- <hr/>
- <div class="content">
- <div class="form">
- <form method="post" action="mail.php" name="contact">
- <div class="column">NOMBRE<br/><br/>
- <input name="name" id="name" value="" />
- </div>
- <div class="column-2">E-MAIL<br/><br/>
- <input name="email" id="email" value="" />
- </div>
- <div class="column-3">MENSAJE<br/><br/>
- <textarea id="message" name="message" ></textarea>
- </div>
- <div class="button">
- <span><input class="submit" id="submit" name="submit" type="submit" value="ENVIAR"></span>
- </div>
- <div id="dialog-message" title="Thank You">
- <p>¡Gracias! Tu mensaje ha sido enviado, te responderemos lo antes posible.</p>
- </div>
- </form>
- </div>
- <div class="contact-text">
- No dudes en solicitarnos información.<br/><br/>
- <strong>RAM Producciones</strong><br/><br/>
- e-mail: <strong>info@ramproducciones.com</strong>
- <br/><br/>
- <a href="https://facebook.com/RAMproduccionesSAC" target="_blank"><img src=img/social/Facebook.png /></a>
- <a href="https://vimeo.com/ramproduccionessac" target="_blank"><img src=img/social/Vimeo.png /></a>
- <a href="https://www.behance.net/RAMProduccionesSAC" target="_blank"><img src=img/social/Behance.png /></a>
- <a href="https://www.instagram.com/ram.producciones" target="_blank"><img src=img/social/Instagram.png /></a>
- <a href="https://www.youtube.com/channel/UCIF9shcqE4D5cF5Xp7LBasg" target="_blank"><img src=img/social/Youtube.png /></a>
- </div>
- </div>
- </section>
- <?php
- // define variables and set to empty values
- $name_error = $email_error = "";
- $name = $email = $message = $success = "";
- //form is submitted with POST method
- if ($_SERVER["REQUEST_METHOD"] == "POST") {
- if (empty($_POST["name"])) {
- $name_error = "Name is required";
- } else {
- $name = test_input($_POST["name"]);
- // check if name only contains letters and whitespace
- if (!preg_match("/^[a-zA-Z ]*$/",$name)) {
- $name_error = "Solo ingresa letras y espacios.";
- }
- }
- if (empty($_POST["email"])) {
- $email_error = "Tu E-mail es necesario";
- } else {
- $email = test_input($_POST["email"]);
- // check if e-mail address is well-formed
- if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
- $email_error = "Formato de E-mail inválido";
- }
- }
- if (empty($_POST["message"])) {
- $message = "";
- } else {
- $message = test_input($_POST["message"]);
- }
- if ($name_error == '' and $email_error == '' and $phone_error == '' and $url_error == '' ){
- $message_body = '';
- unset($_POST['submit']);
- foreach ($_POST as $key => $value){
- $message_body .= "$key: $valuen";
- }
- $to = 'info@ramproducciones.pe';
- $subject = 'Mail vía RAMPRODUCCIONES.PE';
- if (mail($to, $subject, $message)){
- $success = "¡Gracias! Tu mensaje ha sido enviado, te responderemos lo antes posible.";
- $name = $email = $message = '';
- }
- }
- }
- function test_input($data) {
- $data = trim($data);
- $data = stripslashes($data);
- $data = htmlspecialchars($data);
- return $data;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement