jquery - how to add drop-down field in bootstrap contact form and what changes I need to do in php and contact_me.js? -
here bootsrap code. want add dropdown list i'm not sure how work , changes need in php , content_me.js
.
i tried doing changes in php not working.
also, want put add more service button appear when user selects option given drop down. if user clicks add more button button disappears , new dropdown shows up.
<form name="sentmessage" id="contactform" novalidate> <div class="row"> <div class="col-md-6"> <div class="form-group"> <input type="text" class="form-control" placeholder="your name *" id="name" required data-validation-required-message="please enter name."> <p class="help-block text-danger"></p> </div> <div class="form-group"> <input type="email" class="form-control" placeholder="your email *" id="email" required data-validation-required-message="please enter email address."> <p class="help-block text-danger"></p> </div> <div class="form-group"> <input type="tel" class="form-control" placeholder="your phone *" id="phone" required data-validation-required-message="please enter phone number."> <p class="help-block text-danger"></p> </div> <div class="form-group"> <select class="form-control" name="service" id="service"> <option>--select service--</option> <option value="1">option 1</option> <option value="2">option 2</option> <option value="3">option 3</option> <option value="4">option 4</option> </select> <p class="help-block text-danger"></p> </div> </div> <div class="col-md-6"> <div class="form-group"> <textarea class="form-control" placeholder="your message *" id="message" required data-validation-required-message="please enter message."></textarea> <p class="help-block text-danger"></p> </div> </div> <div class="clearfix"></div> <div class="col-lg-12 text-center"> <div id="success"></div> <button type="submit" class="btn btn-xl">send message</button> </div> </div> </form> <?php ob_start(); // check empty fields if(empty($_post['name']) || empty($_post['email']) || empty($_post['phone']) || empty($_post['message']) || empty($_post['service']) || !filter_var($_post['email'],filter_validate_email)) { echo "no arguments provided!"; return false; } $name = $_post['name']; $email_address = $_post['email']; $phone = $_post['phone']; $message = $_post['message']; $service = $_post['service']; // create email , send message $to = 'yourname@yourdomain.com'; // add email address inbetween '' replacing yourname@yourdomain.com - form send message to. $email_subject = "website contact form: $name"; $email_body = "you have received new message website contact form.\n\n"."here details:\n\nname: $name\n\nemail: $email_address\n\nphone: $phone\n\nmessage:\n$message\n\nservice:\n$service"; $headers = "from: noreply@yourdomain.com\n"; // email address generated message from. recommend using noreply@yourdomain.com. $headers .= "reply-to: $email_address"; mail($to,$email_subject,$email_body,$headers); return true; ob_flush();?>
Comments
Post a Comment