<form id="main-contact-form" class="contact-form" name="contact-form" method="post" action="sendemail.php"> <div class="col-sm-5 col-sm-offset-1"> <div class="form-group"> <label>Name *</label> <input type="text" name="name" class="form-control" required="required"> </div> <div class="form-group"> <label>Email *</label> <input type="email" name="email" class="form-control" required="required"> </div> <div class="form-group"> <label>Phone</label> <input type="number" class="form-control"> </div> <div class="form-group"> <label>Company Name</label> <input type="text" class="form-control"> </div> </div> <div class="col-sm-5"> <div class="form-group"> <label>Subject *</label> <input type="text" name="subject" class="form-control" required="required"> </div> <div class="form-group"> <label>Message *</label> <textarea name="message" id="message" required="required" class="form-control" rows="8"></textarea> </div> <div class="form-group"> <button type="submit" name="submit" class="btn btn-primary btn-lg" required="required">Submit Message</button> </div> </div> </form>
<?php header('Content-type: application/json'); $status = array( 'type'=>'success', 'message'=>'Thank you for contact us. As early as possible we will contact you ' ); //$name = @trim(stripslashes($_POST['name'])); //$email = @trim(stripslashes($_POST['email'])); //$subject = @trim(stripslashes($_POST['subject'])); //$message = @trim(stripslashes($_POST['message'])); $name = trim(stripslashes(var_dump($_POST['name']))); $email = trim(stripslashes(var_dump($_POST['email']))); $subject = trim(stripslashes(var_dump($_POST['subject']))); $message = trim(stripslashes(var_dump($_POST['message']))); $email_from = $email; $email_to = 'goncalopalma22@gmail.com';//replace with your email $body = 'Name: ' . $name . "\r\n" . 'Email: ' . $email . "\r\n" . 'Subject: ' . $subject . "\r\n" . 'Message: ' . $message; $success = mail($email_to, $body, 'From: <'.$email_from.'>'); echo json_encode($status); die; ?>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)