Wednesday 15 August 2012

php - bootstrap form - cant add fields -



php - bootstrap form - cant add fields -

i've got twitter bootstrap modern business website , add together 2 fields form. form says been sent nil received.

heres form , contact-me.php

class="snippet-code-html lang-html prettyprint-override"><form name="sentmessage" id="contactform" novalidate> <div class="control-group form-group"> <div class="controls"> <label>full name:</label> <input type="text" class="form-control" id="name" required data-validation-required-message="please come in name."> <p class="help-block"></p> </div> </div> <div class="control-group form-group"> <div class="controls"> <label>foo:</label> <input type="text" class="form-control" id="foo" required data-validation-required-message="foo."> <p class="help-block"></p> </div> </div> <div class="control-group form-group"> <div class="controls"> <label>foo2:</label> <input type="text" class="form-control" id="foo2" required data-validation-required-message="foo2."> <p class="help-block"></p> </div> </div> <div class="control-group form-group"> <div class="controls"> <label>phone number:</label> <input type="tel" class="form-control" id="phone" required data-validation-required-message="please come in phone number."> </div> </div> <div class="control-group form-group"> <div class="controls"> <label>email address:</label> <input type="email" class="form-control" id="email" required data-validation-required-message="please come in email address."> </div> </div> <div class="control-group form-group"> <div class="controls"> <label>message:</label> <textarea rows="10" cols="100" class="form-control" id="message" required data-validation-required-message="please come in message" maxlength="999" style="resize:none"></textarea> </div> </div> <div id="success"></div> <!-- success/fail messages --> <button type="submit" class="btn btn-primary">send message</button> </form>

and contact-me-php

<?php // check if fields passed empty if(empty($_post['name']) || empty($_post['foo']) || empty($_post['foo2']) || empty($_post['phone']) || empty($_post['email']) || empty($_post['message']) || !filter_var($_post['email'],filter_validate_email)) { echo "no arguments provided!"; homecoming false; } $name = $_post['name']; $foo = $_post['foo']; $foo2 = $_post['foo2']; $phone = $_post['phone']; $email_address = $_post['email']; $message = $_post['message']; // create email body , send $to = 'foo@foo.com'; // set email address here $email_subject = "modern business contact form: $name"; // edit email subject line here $email_body = "you have received new message website's contact form.\n\n"."here details:\n\nname: $name\n\nfoo: $foo\n\nfoo2: $foo2\n\nphone: $phone\n\nemail: $email_address\n\nmessage:\n$message"; $headers = "from: noreply@your-domain.com\n"; $headers .= "reply-to: $email_address"; mail($to,$email_subject,$email_body,$headers); homecoming true; ?>

inspect, verify , filter post info see whether info coming through correctly verify can send mails server using , configuration (smtp etc.) correctly set up consider using mail service library instead of manually working error-prone mail service headers, body contents , involved your emails might classified spam , not getting through

php twitter-bootstrap

No comments:

Post a Comment