Contact form isn't sending the message - php

so I am building a contact for mon my website, but for some reasons, I am getting this error
[![error image][1]][1] (https://prnt.sc/vw49gd - link to image as the one uploaded doesn't seem to get it)
My HTML form is fairly simple:
<form class="nk-form-submit" action="form/contact.php" method="post">
<div class="row">
<div class="col-sm-6">
<div class="field-item animated" data-animate="fadeInUp" data-delay="0.8">
<label class="field-label textSubTittleColors ttu">Your Name</label>
<div class="field-wrap">
<input name="contact-name" placeholder="First & Last Name" type="text" class="input-bordered contactUsTextfields required">
</div>
</div>
</div>
<div class="col-sm-6">
<div class="field-item animated" data-animate="fadeInUp" data-delay="0.9">
<label class="field-label textSubTittleColors ttu">Your Email</label>
<div class="field-wrap">
<input name="contact-email" placeholder="example#gmail.com" type="email" class="input-bordered contactUsTextfields required email">
</div>
</div>
</div>
</div>
<div class="field-item animated" data-animate="fadeInUp" data-delay="1.0">
<label class="field-label textSubTittleColors ttu">Your Message</label>
<div class="field-wrap ">
<textarea name="contact-message" placeholder="Leave your question or comment here" class="input-bordered contactUsTextfields input-textarea required"></textarea>
</div>
</div>
<input type="text" class="d-none" name="form-anti-honeypot" value="">
<div class="row">
<div class="col-sm-5 text-right animated" data-animate="fadeInUp" data-delay="1.1">
<button type="submit" name="submit" class="btn sendButton" >SEND</button>
</div>
<div class="col-sm-7 order-sm-first">
<div class="form-results"></div>
</div>
</div>
</form>
But the issue relies on the contact.php code:
<?php
header('Content-type: application/json');
require_once('php-mailer/PHPMailerAutoload.php'); // Include PHPMailer
$mail = new PHPMailer();
$emailTO = $emailBCC = $emailCC = array(); $formEmail = '';
### Enter Your Sitename
$sitename = 'Organization';
### Enter your email addresses: #required
$emailTO[] = array( 'email' => 'myname#microsoftMail.org', 'name' => 'name' );
### Enable bellow parameters & update your BCC email if require.
//$emailBCC[] = array( 'email' => 'email#yoursite.com', 'name' => 'Your Name' );
### Enable bellow parameters & update your CC email if require.
//$emailCC[] = array( 'email' => 'email#yoursite.com', 'name' => 'Your Name' );
### Enter Email Subject
$subject = "Contact Us " . ' - ' . $sitename;
### If your did not recive email after submit form please enable below line and must change to your correct domain name. eg. noreply#example.com
//$formEmail = 'noreply#yoursite.com';
### Success Messages
$msg_success = "We have <strong>successfully</strong> received your message. We'll get back to you soon.";
if( $_SERVER['REQUEST_METHOD'] == 'POST') {
if (isset($_POST["contact-email"]) && $_POST["contact-email"] != '' && isset($_POST["contact-name"]) && $_POST["contact-name"] != '') {
### Form Fields
$cf_email = $_POST["contact-email"];
$cf_name = $_POST["contact-name"];
$cf_message = isset($_POST["contact-message"]) ? $_POST["contact-message"] : '';
$honeypot = isset($_POST["form-anti-honeypot"]) ? $_POST["form-anti-honeypot"] : 'bot';
$bodymsg = '';
if ($honeypot == '' && !(empty($emailTO))) {
### If you want use SMTP
// $mail->isSMTP();
// $mail->SMTPDebug = 0;
// $mail->Host = 'smtp_host';
// $mail->Port = 587;
// $mail->SMTPAuth = true;
// $mail->Username = 'smtp_username';
// $mail->Password = 'smtp_password';
### Regular email configure
$mail->IsHTML(true);
$mail->CharSet = 'UTF-8';
$mail->From = ($formEmail !='') ? $formEmail : $cf_email;
$mail->FromName = $cf_name . ' - ' . $sitename;
$mail->AddReplyTo($cf_email, $cf_name);
$mail->Subject = $subject;
foreach( $emailTO as $to ) {
$mail->AddAddress( $to['email'] , $to['name'] );
}
### if CC found
if (!empty($emailCC)) {
foreach( $emailCC as $cc ) {
$mail->AddCC( $cc['email'] , $cc['name'] );
}
}
### if BCC found
if (!empty($emailBCC)) {
foreach( $emailBCC as $bcc ) {
$mail->AddBCC( $bcc['email'] , $bcc['name'] );
}
}
### Include Form Fields into Body Message
$bodymsg .= isset($cf_name) ? "Contact Name: $cf_name<br><br>" : '';
$bodymsg .= isset($cf_email) ? "Contact Email: $cf_email<br><br>" : '';
$bodymsg .= isset($cf_message) ? "Message: $cf_message<br><br>" : '';
$bodymsg .= $_SERVER['HTTP_REFERER'] ? '<br>---<br><br>This email was sent from: ' . $_SERVER['HTTP_REFERER'] : '';
// Mailing
$mail->MsgHTML( $bodymsg );
$is_emailed = $mail->Send();
if( $is_emailed === true ) {
$response = array ('result' => "success", 'message' => $msg_success);
} else {
$response = array ('result' => "error", 'message' => $mail->ErrorInfo);
}
echo json_encode($response);
} else {
echo json_encode(array ('result' => "error", 'message' => "Bot <strong>Detected</strong>.! Clean yourself Botster.!"));
}
} else {
echo json_encode(array ('result' => "error", 'message' => "Please <strong>Fill up</strong> all required fields and try again."));
}
}
I have uploaded this on the hostgator domain, but every time I click the send button I keep getting the error mentioned above.
I also tried several different codes from either other posts here in stackoverflow or from youtube videos I have seen, but its all the same result.
[1]: https://i.stack.imgur.com/MQQxS.png

You may have used the wrong HTTP request type. Try the method attribute as shown below.
method="get"
As used in:
Change your HTML to:
<form class="nk-form-submit" action="form/contact.php" method="get">
<div class="row">
<div class="col-sm-6">
<div class="field-item animated" data-animate="fadeInUp" data-delay="0.8">
<label class="field-label textSubTittleColors ttu">Your Name</label>
<div class="field-wrap">
<input name="contact-name" placeholder="First & Last Name" type="text" class="input-bordered contactUsTextfields required">
</div>
</div>
</div>
<div class="col-sm-6">
<div class="field-item animated" data-animate="fadeInUp" data-delay="0.9">
<label class="field-label textSubTittleColors ttu">Your Email</label>
<div class="field-wrap">
<input name="contact-email" placeholder="example#gmail.com" type="email" class="input-bordered contactUsTextfields required email">
</div>
</div>
</div>
</div>
<div class="field-item animated" data-animate="fadeInUp" data-delay="1.0">
<label class="field-label textSubTittleColors ttu">Your Message</label>
<div class="field-wrap ">
<textarea name="contact-message" placeholder="Leave your question or comment here" class="input-bordered contactUsTextfields input-textarea required"></textarea>
</div>
</div>
<input type="text" class="d-none" name="form-anti-honeypot" value="">
<div class="row">
<div class="col-sm-5 text-right animated" data-animate="fadeInUp" data-delay="1.1">
<button type="submit" name="submit" class="btn sendButton" >SEND</button>
</div>
<div class="col-sm-7 order-sm-first">
<div class="form-results"></div>
</div>
</div>
</form>

Related

How to send message to contact us page using PHP

I have a contact us page in html including a form where a user can send message with that form. I want to send the message with PHP mailer function. But the problem is after i sending the message I want to redirect to the page with message. But instead of loading the it's showing the response in a new page. How do i send the user to the same page again?
Here is my Contact.html
<?php
if (isset($arrResult)) {
if($arrResult['response'] == 'success') {
?>
<div class="alert alert-success" id="contactSuccess">
<strong>Success!</strong> Your message has been sent to us.
</div>
<?php
} else if($arrResult['response'] == 'error') {
?>
<div class="alert alert-danger" id="contactError">
<strong>Error!</strong> There was an error sending your message. (<?php echo $arrResult['error'];?>)
</div>
<?php
}
}
?>
<h2 class="mb-sm mt-sm"><strong>Contact</strong> Us</h2>
<form id="contactForm" action="php/contact-form.php" method="POST">
<div class="row">
<div class="form-group">
<div class="col-md-6">
<label>Your name *</label>
<input type="text" value="" data-msg-required="Please enter your name." maxlength="100" class="form-control" name="name" id="name" required>
</div>
<div class="col-md-6">
<label>Your email address *</label>
<input type="email" value="" data-msg-required="Please enter your email address." data-msg-email="Please enter a valid email address." maxlength="100" class="form-control" name="email" id="email" required>
</div>
</div>
</div>
<div class="row">
<div class="form-group">
<div class="col-md-12">
<label>Subject</label>
<input type="text" value="" data-msg-required="Please enter the subject." maxlength="100" class="form-control" name="subject" id="subject" required>
</div>
</div>
</div>
<div class="row">
<div class="form-group">
<div class="col-md-12">
<label>Message *</label>
<textarea maxlength="5000" data-msg-required="Please enter your message." rows="10" class="form-control" name="message" id="message" required></textarea>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<input type="submit" value="Send Message" onclick="myFunction()"class="btn btn-primary btn-lg mb-xlg" data-loading-text="Loading...">
</div>
</div>
</form>
</div>
Here is the contact-form.php
<?php
session_cache_limiter('nocache');
header('Expires: ' . gmdate('r', 0));
header('Content-type: application/json');
require_once('php-mailer/PHPMailerAutoload.php');
$email = 'myemail#yahoo.co';
$subject = $_POST['subject'];
$fields = array(
0 => array(
'text' => 'Name',
'val' => $_POST['name']
),
1 => array(
'text' => 'Email address',
'val' => $_POST['email']
),
2 => array(
'text' => 'Message',
'val' => $_POST['message']
)
);
$message = '';
foreach($fields as $field) {
$message .= $field['text'].": " . htmlspecialchars($field['val'], ENT_QUOTES) . "<br>\n";
}
$mail = new PHPMailer(true);
try {
$mail->SMTPDebug = $debug;
$mail->AddAddress($email);
$mail->SetFrom($email, $_POST['name']);
$mail->AddReplyTo($_POST['email'], $_POST['name']);
$mail->IsHTML(true); // Set email format to HTML
$mail->CharSet = 'UTF-8';
$mail->Subject = $subject;
$mail->Body = $message;
$mail->Send();
$arrResult = array ('response'=>'success');
} catch (phpmailerException $e) {
$arrResult = array ('response'=>'error','errorMessage'=>$e->errorMessage());
} catch (Exception $e) {
$arrResult = array ('response'=>'error','errorMessage'=>$e->getMessage());
}
if ($debug == 0) {
echo json_encode($arrResult);
}
Use header
header('Location: http://www.example.com/')
Header doc

PHP Script is correct, but not sending

I am having difficulty with my php code. From my tired eyes, the code is correct, and I've had multiple others look at the code. No one can figure out why it's not working. It must be something quite simple, but I cannot get the contact form to send.
PHP script:
<?php
$from = 'email#example.com';
$sendTo = 'email#example.com';
$subject = 'New message from contact form';
$fields = array('name' => 'Name', 'surname' => 'Surname', 'phone' => 'Phone', 'email' => 'Email', 'message' => 'Message');
$htmlHeader = '';
$htmlFooter = '';
$okMessage = 'Contact form succesfully submitted. Thank you, We will get back to you soon!';
$htmlContent = '<h1>New message from contact form</h1>';
use Nette\Mail\Message,
Nette\Mail\SendmailMailer;
require 'php/Nette/nette.phar';
$configurator = new Nette\Configurator;
$configurator->setTempDirectory(__DIR__ . '/php/temp');
$container = $configurator->createContainer();
$httpRequest = $container->getService('httpRequest');
$httpResponse = $container->getService('httpResponse');
$post = $httpRequest->getPost();
if ($httpRequest->isAjax()) {
$htmlContent .= '<table>';
foreach ($post as $key => $value) {
if (isset($fields[$key])) {
$htmlContent .= "<tr><th>$fields[$key]</th><td>$value</td></tr>";
}
}
$htmlContent .= '</table>';
$htmlBody = $htmlHeader . $htmlContent . $htmlFooter;
$mail = new Message;
$mail->setFrom($from)
->addTo($sendTo)
->setSubject($subject)
->setHtmlBody($htmlBody, FALSE);
$mailer = new SendmailMailer;
$mailer->send($mail);
$responseArray = array('type' => 'success', 'message' => $okMessage);
$httpResponse->setCode(200);
$response = new \Nette\Application\Responses\JsonResponse($responseArray);
$response->send($httpRequest, $httpResponse);
}
Contact Form HTML:
<div class="section contact soepa" id="contact" data-animate="bounceIn">
<div class="container">
<div class="col-md-12">
<h2 class="title"><span style="color: #f46b01;">Connect With Us</span></h2>
<div class="row">
<div class="col-md-8 col-md-offset-2">
<form id="contact-form" method="post" action="contact.php">
<div class="messages">
</div>
<div class="controls">
<div class="row">
<div class="col-md-6">
<input type="text" name="name" class="form-control" placeholder="Your firstname *" required="required">
</div>
<div class="col-md-6">
<input type="text" name="surname" class="form-control" placeholder="Your lastname *" required="required">
</div>
<div class="col-md-6">
<input type="text" name="email" class="form-control" placeholder="Your email *" required="required">
</div>
<div class="col-md-6">
<input type="text" name="phone" class="form-control" placeholder="Your phone *" required="required">
</div>
<div class="col-md-12">
<textarea name="message" class="form-control" placeholder="Message *" rows="4" required="required"></textarea>
</div>
<div class="col-md-12 text-center">
<input type="submit" class="btn btn-primary btn-lg" value="Send message">
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>

Codeigniter Contact form submit returning timeout

Hi I am wondering if anyone could give me some insight into why my Codeigniter contact form just times out on submit?
I understand this is a beginner error but I feel like it is something I am completely overlooking. I have provided the controller and view.
I do have email.php setup in the Config file as well, with the various helpers and libraries loaded. Thank you in advance!
Controller
<?php
class contactform extends CI_Controller
{
public function __construct()
{
parent::__construct();
$this->load->helper(array('form','url'));
$this->load->library(array('session', 'form_validation', 'email'));
}
function index()
{
//set validation rules
$this->form_validation->set_rules('name', 'Name', 'trim|required|xss_clean|callback_alpha_space_only');
$this->form_validation->set_rules('email', 'Emaid ID', 'trim|required|valid_email');
$this->form_validation->set_rules('subject', 'Subject', 'trim|required|xss_clean');
$this->form_validation->set_rules('message', 'Message', 'trim|required|xss_clean');
//run validation on form input
if ($this->form_validation->run() == FALSE) {
//validation fails
$this->load->view('contact_form_view');
} else {
//get the form data
$name = $this->input->post('name');
$from_email = $this->input->post('email');
$subject = $this->input->post('subject');
$message = $this->input->post('message');
//set to_email id to receive emails
$to_email = 'littleliongirldesigns#gmail.com';
//configure email settings
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'ssl://smtp.gmail.com';
$config['smtp_port'] = '465';
$config['smtp_user'] = 'email';
$config['smtp_pass'] = 'password';
$config['mailtype'] = 'html';
$config['charset'] = 'iso-8859-1';
$config['wordwrap'] = TRUE;
$config['newline'] = "\r\n"; //use double quotes
$this->load->library('email', $config);
$this->email->initialize($config);
//send mail
$this->email->from($from_email, $name);
$this->email->to($to_email);
$this->email->subject($subject);
$this->email->message($message);
if ($this->email->send()) {
// mail sent
$this->session->set_flashdata('msg','<div class="alert alert-success text-center">Your mail has been sent successfully!</div>');
redirect('contactform/index');
} else {
//error
$this->session->set_flashdata('msg','<div class="alert alert-danger text-center">There is error in sending mail! Please try again later</div>');
redirect('contactform/index');
}
}
}
//custom validation function to accept only alphabets and space input
function alpha_space_only($str)
{
if (!preg_match("/^[a-zA-Z ]+$/",$str)) {
$this->form_validation->set_message('alpha_space_only', 'The %s field must contain only alphabets and space');
return FALSE;
} else {
return TRUE;
}
}
}
?>
View
<div class="container">
<div class="row">
<div class="col-md-6 col-md-offset-3 well">
<?php $attributes = array("class" => "form-horizontal", "name" => "contactform");
echo form_open("contactform/index", $attributes);?>
<fieldset>
<legend>Contact Form</legend>
<div class="form-group">
<div class="col-md-12">
<label for="name" class="control-label">Name</label>
</div>
<div class="col-md-12">
<input class="form-control" name"name" placeholder="Your Name" type="text" value="<?php echo set_value('name'); ?>"/>
<span class="text-danger"><?php echo form_error('name'); ?></span>
</div>
</div>
<div class="form-group">
<div class="col-md-12">
<label for="email" class="control-label">Email ID</label>
</div>
<div class="col-md-12">
<input class="form-control" name="email" placeholder="Your email" type="text" value="<?php echo set_value('email'); ?>" />
<span class="text-danger"><?php echo form_error('email');?></span>
</div>
</div>
<div class="form-group">
<div class="col-md-12">
<label for="subject" class="control-label">Subject</label>
</div>
<div class="col-md-12">
<input class="form-control" name="subject" placeholder="Subject" type="text" value="<?php echo set_value('subject'); ?>"/>
<span class="text-danger"><?php echo form_error('subject');?></span>
</div>
</div>
<div class="form-group">
<div class="col-md-12">
<label for="message" class="control-label">Message</label>
</div>
<div class="col-md-12">
<textarea class="form-control" name="message" rows="4" placeholder="Your Message"><?php echo set_value('message');?></textarea>
<span class="text-danger"><?php echo form_error('message'); ?></span>
</div>
</div>
<div class="form-group">
<div class="col-md-12">
<input name="submit" type="submit" class="btn btn-primary" value="Send" />
</div>
</div>
</fieldset>
<?php echo form_close(); ?>
<?php echo $this->session->flashdata('msg'); ?>
</div>
</div>
</div>

I can't get this form to work either from localhost or online using codeigniter

I have the Contact Me form that I can't get to send me an email. I am still a newbie but I don't see anything wrong. Help me out guys.
Here's the contactform controller
<?php
class contactform extends CI_Controller {
public function __construct() {
parent::__construct();
$this->load->helper(array('form','url'));
$this->load->library(array('session', 'form_validation', 'email'));
}
function index() {
//set validation rules
$this->form_validation->set_rules('name', 'Name', 'trim|required|xss_clean|callback_alpha_space_only');
$this->form_validation->set_rules('email', 'Emaid ID', 'trim|required|valid_email');
$this->form_validation->set_rules('subject', 'Subject', 'trim|required|xss_clean');
$this->form_validation->set_rules('message', 'Message', 'trim|required|xss_clean');
//run validation on form input
if ($this->form_validation->run() == FALSE) {
//validation fails
//$this->load->view('contact_view');
$this->load->view('header_view');
$this->load->view('nav_view');
$this->load->view('contact_view');
$this->load->view('footer_view');
}
else {
//get the form data
$name = $this->input->post('name');
$from_email = $this->input->post('email');
$subject = $this->input->post('subject');
$message = $this->input->post('message');
//set to_email id to which you want to receive mails
$to_email = 'mygmail#gmail.com';
//configure email settings
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'ssl://smtp.gmail.com';
$config['smtp_port'] = '465';
$config['smtp_user'] = 'mygmail#gmail.com';
$config['smtp_pass'] = 'mypass';
$config['mailtype'] = 'html';
$config['charset'] = 'iso-8859-1';
$config['wordwrap'] = TRUE;
$config['newline'] = "\r\n"; //use double quotes
//$this->load->library('email', $config);
$this->email->initialize($config);
//send mail
$this->email->from($from_email, $name);
$this->email->to($to_email);
$this->email->subject($subject);
$this->email->message($message);
if ($this->email->send())
{
// mail sent
$this->session->set_flashdata('msg','<div class="alert alert-success text-center">Your mail has been sent successfully!</div>');
redirect('contactform/index');
}
else
{
//error
$this->session->set_flashdata('msg','<div class="alert alert-danger text-center">There is error in sending mail! Please try again later</div>');
redirect('contactform/index');
}
}
}
//custom validation function to accept only alphabets and space input
function alpha_space_only($str) {
if (!preg_match("/^[a-zA-Z ]+$/",$str)) {
$this->form_validation->set_message('alpha_space_only', 'The %s field must contain only alphabets and space');
return FALSE;
}
else {
return TRUE;
}
}
}
?>
and here is my contact_view
<div class="container">
<div class="row">
<div class="col-md-6 col-md-offset-3 well">
<?php $attributes = array("class" => "form-horizontal", "name" => "contactform");
echo form_open("contactform/index", $attributes);?>
<fieldset>
<legend>Contact Form</legend>
<div class="form-group">
<div class="col-md-12">
<label for="name" class="control-label">Name</label>
</div>
<div class="col-md-12">
<input class="form-control" name="name" placeholder="Your Full Name" type="text" value="<?php echo set_value('name'); ?>" />
<span class="text-danger"><?php echo form_error('name'); ?></span>
</div>
</div>
<div class="form-group">
<div class="col-md-12">
<label for="email" class="control-label">Email ID</label>
</div>
<div class="col-md-12">
<input class="form-control" name="email" placeholder="Your Email ID" type="text" value="<?php echo set_value('email'); ?>" />
<span class="text-danger"><?php echo form_error('email'); ?></span>
</div>
</div>
<div class="form-group">
<div class="col-md-12">
<label for="subject" class="control-label">Subject</label>
</div>
<div class="col-md-12">
<input class="form-control" name="subject" placeholder="Your Subject" type="text" value="<?php echo set_value('subject'); ?>" />
<span class="text-danger"><?php echo form_error('subject'); ?></span>
</div>
</div>
<div class="form-group">
<div class="col-md-12">
<label for="message" class="control-label">Message</label>
</div>
<div class="col-md-12">
<textarea class="form-control" name="message" rows="4" placeholder="Your Message"><?php echo set_value('message'); ?></textarea>
<span class="text-danger"><?php echo form_error('message'); ?></span>
</div>
</div>
<div class="form-group">
<div class="col-md-12">
<input name="submit" type="submit" class="btn btn-primary" value="Send" />
</div>
</div>
</fieldset>
<?php echo form_close(); ?>
<?php echo $this->session->flashdata('msg'); ?>
</div>
</div>
I already checked my codes. But the problem is, I can't see why it cant send. I even tried to upload it to my website, but it still won't let me send an email.

Can we subscribe using MailChimp through localhost?

I am doing this first time. I want to ask, can I subscribe using MailChimp through my local server because I am having problem in doing that every time. When I subscribe I do not receive any mail. Here is the code
<?php
// change this path if the class file isn't in the same directory!
include_once 'MailChimp.php';
$alertclass = 'alert-warning';
$msg = '';
$name = '';
$email = '';
if (isset($POST['Submit'])) {
if (empty($_POST['name']) || empty($_POST['email'])) {
$msg = 'Please enter a name and email address.';
} else {
$name = filter_var($_POST['name'], FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW);
$email = filter_var($_POST['email'], FILTER_SANITIZE_EMAIL);
/*
* Place here your validation and other code you're using to process your contact form.
*/
$mc = new \Drewm\MailChimp('xxxxxxxxx-us11');
$mvars = array('optin_ip'=> $_SERVER['REMOTE_ADDR'], 'FNAME' => $name);
$result = $mc->call('lists/subscribe', array(
'id' => 'f660c6ba5f',
'email' => array('email'=>$email),
'merge_vars' => $mvars,
'double_optin' => true,
'update_existing' => false,
'replace_interests' => false,
'send_welcome' => false
)
);
if (!empty($result['euid'])) {
$msg = 'Thanks, please check your mailbox and confirm the subscription.';
$alertclass = 'alert-success';
} else {
if (isset($result['status'])) {
switch ($result['code']) {
case 214:
$msg = 'You\'re already a member of this list.';
break;
// check the MailChimp API if you like to add more options
default:
$msg = 'An unknown error occurred.';
$alertclass = 'alert-error';
break;
}
}$msg="asdasdad";
}
}
}
?>
I am very new to this.
html code
<form class="form-horizontal"action="contactform-mailchimp.php" method="post">
<?php
//if ($msg != '')
echo '
<div class="alert '.$alertclass.'" role="alert">'.$msg.'</div>';
?>
<div class="form-group">
<label for="inputName" class="col-sm-2 control-label">First name</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="name" id="inputName">
</div>
</div>
<div class="form-group">
<label for="inputEmail" class="col-sm-2 control-label">Email</label>
<div class="col-sm-10">
<input type="email" class="form-control" name="email" id="inputEmail">
</div>
</div>
<div class="form-group">
<label for="inputMessage" class="col-sm-2 control-label">Message</label>
<div class="col-sm-10">
<textarea class="form-control" rows="3" name="message" id="inputMessage"></textarea>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<div class="checkbox">
<label>
<input type="checkbox" name="newsletter"> Subscribe to newsletter
</label>
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" name="Submit" class="btn btn-default">Submit</button>
</div>
</div>
</form>

Categories