<form role="form" action="" method="post">
<div class="form-group">
<label class="sr-only" for="form-username">First Name:</label>
<input type="text" name="firstname" placeholder="First Name" class="form-username form-control" id="form-username" required="">
</div>
<div class="form-group">
<label class="sr-only" for="form-username">Middle Name:</label>
<input type="text" name="middlename" placeholder="Middle Name" class="form-username form-control" id="form-username">
</div>
<div class="form-group">
<label class="sr-only" for="form-username">Last Name:</label>
<input type="text" name="lastname" placeholder="Last Name" class="form-username form-control" id="form-username" required="">
</div>
<div class="form-group">
<label class="sr-only" for="form-username">Address:</label>
<input type="text" name="address" placeholder="Address" class="form-username form-control" id="form-username" required="">
</div>
<div class="form-group">
<label class="sr-only" for="form-username">Phone No:</label>
<input type="text" name="phoneno" placeholder="Phone No" class="form-username form-control" id="form-username" required="">
</div>
<div class="form-group">
<label class="sr-only" for="form-username">Email Id:</label>
<input type="email" name="email" placeholder="Email Id" class="form-username form-control" id="form-username" required="">
</div>
<div class="form-group">
<label class="sr-only" for="form-username">Password:</label>
<input type="password" name="password" placeholder="Password" class="form-username form-control" id="form-username" required="">
</div>
<button type="submit" name="submit" class="btn">Sign in!</button>
</form>
<?php include_once('config.php');
if(isset($_POST['submit'])) {
$firstname = $_POST['firstname'];
$middlename = $_POST['middlename'];
$lastname = $_POST['lastname'];
$address =$_POST['address'];
$phoneno = $_POST['phoneno'];
$email = $_POST['email'];
$password = $_POST['password'];
//query
$query ="INSERT INTO login(`id`, `first_name`, `middle_name`, `last_name`, `address`, `phone_no`, `email`, `password`) VALUES ('',$firstname','$middlename','$lastname','$address','$phoneno','$email','$password')";
$result = #mysqli_query($query,$link);
if (!$result) {
echo "Data is not Inserted"; //this statement show me all time when submitting the data
}else { echo "Data is Inserted Successful";}}?>
Can u help me what mistake i m doing.
There are several things you can do:
Remove # in front of myslqi_query to show the error message.
If you still see no error message, then make sure that errors will get reported. See display-errors and error_reporting().
Do echo $query right after it is defined. If the query looks right, then copy it, and try running it against your database, using a MySQL client, such as HeidiSQL, or mysql command line.
Correct your english. Do not use "SMS english". It will encourage people to help you.
Related
I am trying to show an error message of validation that phone is already registered and redirect to the same form without refreshing the data entered in form text fields.
How can I do that?
<?php
include 'connection.php';
$first_name = $_POST['first_name'];
$last_name = mysqli_real_escape_string($con,$_POST['last_name']);
$email = mysqli_real_escape_string($con,$_POST['email']);
$phone = $_POST['phone'];
$address = mysqli_real_escape_string($con,$_POST['address']);
$user_query = "INSERT INTO `user`( `first_name`, `last_name`, `email`, `phone`,`address`)"
. " VALUES ('$first_name','$last_name','$email','$phone','$address')";
$user_query_submit = mysqli_query($con, $user_query);
if($user_query_submit === TRUE)
{
header( "Location:index.php" );
}
else
{
echo "<script>
alert('This phone is already registered');
window.location.href='sign_up.php';
</script>";
}
?>
<form role="form" action="sign_up.php" method="post">
<div class="box-body">
<div class="form-group">
<label for="first-name">First Name</label>
<input type="text" class="form-control" id="first_name" name="first_name" placeholder="Enter First name" required="true">
</div>
<div class="form-group">
<label for="last-name">Last Name</label>
<input type="text" class="form-control" id="last_name" name="last_name" placeholder="Enter Last Name" required="true">
</div>
<div class="form-group">
<label for="email">Email address</label>
<input type="email" class="form-control" id="email" name="email" placeholder="Enter email" required="true">
</div><div class="form-group">
<label for="phone">Contact</label>
<input type="number" class="form-control" id="phone" name="phone" placeholder="Enter contact no" required="true">
</div>
<div class="form-group">
<label for="address"> Address</label>
<input type="text" class="form-control" id="Address" name="address" placeholder="Enter Address" required="true">
</div>
<div class="box-footer">
<button type="submit" class="btn btn-primary">Submit</button>
</div>
</form>
So how can show error message box without refreshing form in my form?
When I click ok button in error MSG box all entries of my of my form are refreshed and I want to see all my entries same in form.
Can some help me?
try this code and about the validation on the phone you should primary key the phone
it should be like this
got the idea on this page you should check it out to learn mode about ajax
https://steemit.com/utopian-io/#sogata/how-to-insert-data-to-mysql-from-php-using-jquery-ajax
index.php
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
</head>
<body>
<div class="box-body">
<div class="form-group">
<label for="first-name">First Name</label>
<input type="text" class="form-control" id="first_name" name="first_name" placeholder="Enter First name" required="true">
</div>
<div class="form-group">
<label for="last-name">Last Name</label>
<input type="text" class="form-control" id="last_name" name="last_name" placeholder="Enter Last Name" required="true">
</div>
<div class="form-group">
<label for="email">Email address</label>
<input type="email" class="form-control" id="email" name="email" placeholder="Enter email" required="true">
</div><div class="form-group">
<label for="phone">Contact</label>
<input type="number" class="form-control" id="phone" name="phone" placeholder="Enter contact no" required="true">
</div>
<div class="form-group">
<label for="address"> Address</label>
<input type="text" class="form-control" id="Address" name="address" placeholder="Enter Address" required="true">
</div>
<div class="box-footer">
<button type="submit" id="button" class="btn btn-primary">Submit</button>
</div>
<script>
$(document).ready(function(){
$("#button").click(function(){
var first_name =$("#first_name").val();
var last_name = $("#last_name").val();
var email=$("#email").val();
var phone=$("#phone").val();
var Address=$("#Address").val();
$.ajax({
url:'fetch.php',
method:'POST',
data:{
first_name:first_name,
last_name:last_name,
email:email,
phone:phone,
Address:Address
},
success:function(data){
alert(data);
document.location.href = "help.php";
}
});
});
});
</script>
</body>
</html>
fetch.php
<?php
$conn =new mysqli("localhost","root","","yourdatabase");
$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$address = $_POST['Address'];
$user_query = "INSERT INTO `user`( `first_name`, `last_name`, `email`, `phone`,`address`)"
. " VALUES ('$first_name','$last_name','$email','$phone','$address')";
if($conn->query($user_query ) === TRUE)
{
echo "Data Inserted";
}
else
{
echo "Contact Should be Unique";
}
?>
I have to create a form where answers get sent to the database but when I fill in the form the database is not updating and I have getting the self made error :"something went wrong". Can anyone see anything wrong? Thanks.
Form:
<form id="contact-form" method="post" action="sentEnquiries.php" name="enquiries">
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label for="name">
Name</label>
<div class="input-group">
<span class="input-group-addon"><span class="glyphicon glyphicon-user"></span>
</span>
<input type="text" class="form-control" id="name" name="name" placeholder="Enter name" required="required" /></div>
</div>
<div class="form-group">
<label for="email">
Email Address</label>
<div class="input-group">
<span class="input-group-addon"><span class="glyphicon glyphicon-envelope"></span>
</span>
<input type="email" class="form-control" id="email" name="email" placeholder="Enter email" required="required" /></div>
</div>
<div class="form-group">
<label for="phoneNumber">
Phone Number</label>
<div class="input-group">
<span class="input-group-addon"><span class="glyphicon glyphicon-earphone"></span>
</span>
<input type="tel" class="form-control" id="phoneNumber" name="phone" placeholder="Enter phone number" required="required" /></div>
</div>
<div class="form-group">
<label for="partySize">
Party Size</label>
<input type="number" min="1" max="6" class="form-control" id="partySize" name="partySize" required="required" />
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="arrivalDate">
Arrival Date</label>
<input type="date" class="form-control" id="arrivalDate" name="arrivalDate" />
</div>
<div class="form-group">
<label for="departureDate">
Departure Date</label>
<input type="date" class="form-control" id="departureDate" name="departureDate"/>
</div>
<div class="form-group">
<label for="name">
Message</label>
<textarea name="message" id="message" class="form-control" rows="9" cols="25" required="required"
placeholder="Message"></textarea>
</div>
</div>
<div class="col-md-12">
<button type="submit" class="btn btn-skin pull-right" id="btnContactUs">
Send enquiry</button>
</div>
</div>
</form>
Answers:
<?php
include("conn.php");
$sentName = $_POST['name'];
$sentEmail = $_POST['email'];
$sentPhone = $_POST['phone'];
$sentPartySize = $_POST['partySize'];
$sentArrivalDate = $_POST['arrivalDate'];
$sentDepartureDate = $_POST['departureDate'];
$sentMessage = $_POST['message'];
$insertQuery = "INSERT INTO Enquiries(enquiryID, name, email, phone, partySize, arrivalDate, departureDate, message) VALUES(NULL, '$sentName', '$sentEmail', '$sentPhone, '$sentPartySize', $sentArrivalDate, '$sentDepartureDate', '$sentMessage')";
?>
Further down answers doc:
<div class="descriptions">
<?php
if(mysqli_query($conn, $insertQuery)) {
echo "<p>Thank you for your enquiry.</p>";
mysqli_close($conn);
} else {
echo "<p>Something went wrong.</p>";
mysqli_close($conn);
}
?>
</div>
could you make sure as below :
enquiryID column, is this column is auto increment if not better you set the id become auto increment primary key
For debug purposes, can you echo first in $_POST['name'] then exit; to make sure that the post data from your html is work correctly.
if that not work, you should try to select first from database with simple query, so you will know the connection to database table is work correctly
Here is how i'd do it.
Change yours as required but here's my example:
PDO class:
class form
{
public function sendForm($name, $email, $phone, $party, $date, $depart, $message)
{
$stmt = $this->conn->prepare("INSERT INTO `enquiries` (`name`,`email`,`phone`,`partySize`,`arrivalDate`,`departureDate`,`message`) VALUES (:fname, :email, :phone, :party, :arrive, :depart, :msg)");
$stmt->bindParam(array(':fname' => $name, ':email' => $email, ':phone' => $phone, ':party' => $party, ':arrive' => $date, ':depart' => $depart, ':msg' => $message));
$stmt->execute();
}
}
Then within your form page:
$form = new form();
if (isset($_POST['sendIt']))
{
$form->sendForm($_POST['Fname'],$_POST['email'],$_POST['phone'],$_POST['size'],$_POST['date'],$_POST['depart'],$_POST['message']);
}
Then my basic form without the div tagging so you'll need to tweak slightly:
<form action="" method="post">
<input type="text" name="Fname">
<input type="email" name="email">
<input type="text" name="phone">
<input type="text" name="size">
<input type="text" name="date">
<input type="text" name="depart">
<textarea name="message" id="" cols="30" rows="10"></textarea>
<input type="submit" name="sendIt">
</form>
This is a very basic one with no thank you message or conditions but you can easily add conditions before running the query by doing
if (!empty($var)
{
// do something
} else {
echo "you didnt fill this in...";
The email I receive only shows the message, not the email address or phone number or even the name.
It also doesn't show from which email it has been sent.
I should receive whole information from the form, otherwise it wouldn't show me the message, I guess.
Maybe someone has more simple code than this one?
I tried but I'm stuck.
Can someone help me out?
Below is the HTML and PHP code
HTML Code:
<form name="mail" action="mail.php" method="post" >
<div class="form-group ">
<input id="name" class="form-control" placeholder="Name" type="text" required>
<label for="name" class="sr-only">Name</label>
</div>
<div class="form-group ">
<label for="email" class="sr-only">Email</label>
<input id="email" class="form-control" placeholder="Email" type="email" required>
</div>
<div class="form-group ">
<label for="phone" class="sr-only">Phone</label>
<input id="phone" class="form-control" placeholder="Phone" type="text" required>
</div>
<div class="form-group ">
<label for="message" class="sr-only">Message</label>
<textarea name="message" id="message" cols="30" rows="5" class="form-control" placeholder="Message" required></textarea>
</div>
<div class="form-group ">
<input class="btn btn-primary btn-lg" value="Send Message" name="submit" type="submit">
</div>
</div>
</form>
PHP code:
<?php
if(!isset($_POST['submit']))
{
//This page should not be accessed directly. Need to submit the form.
echo "error; you need to submit the form!";
}
$name = $_POST['name'];
$phone = $_POST['phone'];
$email = $_POST['email'];
$message = $_POST['message'];
$email_from = "$email";//<== update the email address
$email_subject = "New Form submission";
$email_phone = $phone;
$email_body = "You have received a new message from the user ".$name.
"\nHere is the message:\n ".$message.
"\nThe phone number:\n ".$phone.
"The email:\n ".$email.
$to = "info#czwebdesign.be";//<== update the email address
$headers = "From: $email_from \r\n";
$headers .= "Reply-To: $email \r\n";
//Send the email!
mail($to,$email_subject,$email_body,$headers);
//done. redirect to thank-you page.
header('Location: index.html');
?>
You also need to use name attribute for other fields as well same like message field, something like:
<input name="email" class="form-control" placeholder="Email" required>
<input name="name" class="form-control" placeholder="NAme" required>
<input name="phone" class="form-control" placeholder="Phone" required>
Otherwise you will get the Undefined Index warning in your script.
It's better to use php error_reporting() in your development mode, this will help to find out all errors and warnings in your code.
// Same as error_reporting(E_ALL);
ini_set('error_reporting', E_ALL);
// Report all PHP errors (see changelog)
error_reporting(E_ALL);
Try this
<form name="mail" action="mail.php" method="post" >
<div class="form-group ">
<input id="name" class="form-control" placeholder="Name" type="text" name="name" required>
<label for="name" class="sr-only">Name</label>
</div>
<div class="form-group ">
<label for="email" class="sr-only">Email</label>
<input id="email" name="email" class="form-control" placeholder="Email" type="email" required>
</div>
<div class="form-group ">
<label for="phone" class="sr-only">Phone</label>
<input id="phone" name="phone" class="form-control" placeholder="Phone" type="text" required>
</div>
<div class="form-group ">
<label for="message" class="sr-only">Message</label>
<textarea name="message" id="message" cols="30" rows="5" class="form-control" placeholder="Message" required></textarea>
</div>
<div class="form-group ">
<input class="btn btn-primary btn-lg" value="Send Message" name="submit" type="submit">
</div>
</div>
</form>
Look here at the missing name="" attribute in your <input>
Use this code instead:
<form name="mail" action="mail.php" method="post" >
<div class="form-group ">
<input name="name" id="name" class="form-control" placeholder="Name" type="text" required>
<label for="name" class="sr-only">Name</label>
</div>
<div class="form-group ">
<label for="email" class="sr-only">Email</label>
<input name="email" id="email" class="form-control" placeholder="Email" type="email" required>
</div>
<div class="form-group ">
<label for="phone" class="sr-only">Phone</label>
<input name="phone" id="phone" class="form-control" placeholder="Phone" type="text" required>
</div>
<div class="form-group ">
<label for="message" class="sr-only">Message</label>
<textarea name="message" id="message" cols="30" rows="5" class="form-control" placeholder="Message" required></textarea>
</div>
<div class="form-group ">
<input class="btn btn-primary btn-lg" value="Send Message" name="submit" type="submit">
</div>
</div>
</form>
I am trying to insert a row in a table but its giving me syntax error.
Here is the HTML Code:
<form method="post" action="" >
<!--form fields-->
<div class="control-group">
<div class="customer_data">
<div class="controls" id="id_milesPerDay">
<label for="ICAO" class="left-text">ICAO:</label>
<input type="text" id="ICAO" style='text-transform:uppercase' maxlength="4" name="ICAO" placeholder="" class="input-xlarge" required>
</div>
<div class="controls">
<label for="IATA" class="left-text">IATA:</label>
<input type="text" name="IATA" maxlength="3" style='text-transform:uppercase' id="IATA" placeholder="" class="input-xlarge" required>
</div>
<div class="controls">
<label for="airportname" class="left-text">Airport Name:</label>
<input type="text" name="airport_name" maxlength="" id="Airport_Name" placeholder="" class="input-xlarge" required>
</div>
<div class="controls">
<label for="coordinates" class="left-text">Coordinates:</label>
<input type="text" name="coordinates" maxlength="" id="Coordinates" placeholder="" class="input-xlarge" required>
</div>
<div class="controls">
<label for="Time_zone_UTC" class="left-text">Time Zone UTC:</label>
<input type="text" name="Time_zone_UTC" maxlength="3" id="Time_zone_UTC" placeholder="" class="input-xlarge" required>
</div>
<div class="controls">
<label for="DST" class="left-text">DST:</label>
<input type="checkbox" name="dst" value="other" id="DST" placeholder="" class="input-xlarge">
</div>
<div class="controls text">
<label for="utc" class="left-text">UTC:</label>
<input type="text" name="utc" maxlength="3" id="UTC" placeholder="" class="input-xlarge">
</div>
<div class="controls text">
<label for="From_date" class="left-text">From Date:</label>
<input type="date" name="from_date" maxlength="" id="fromdate" placeholder="" class="input-xlarge">
</div>
<div class="controls text">
<label for="To_date" class="left-text">To Date:</label>
<input type="date" name="to_date" maxlength="" id="todate" placeholder="" class="input-xlarge">
</div>
<!-- Button -->
<div class="control-group">
<div class="controls">
<input type="submit" value="Submit" id="Submit" class="btn btn-success" name="Submit">
</div>
</div>
</div>
<div class="customer_aircraft">
<div class="controls">
<label for="country_code" class="left-text">Country Code:</label>
<input type="text" name="country_code" maxlength="2" style='text-transform:uppercase' id="countrycode" placeholder="" class="input-xlarge" required>
</div>
<div class="controls">
<label for="Remarks" class="left-text">Remarks:</label>
<textarea cols="25" rows="7" name="remarks" id="remarks" placeholder="" class="input-xlarge"></textarea>
</div>
<div class="controls">
<label for="Country" class="left-text">Country: </label>
<input type="text" name="country" maxlength="" id="country" placeholder="" class="input-xlarge" required>
</div>
</div>
</div>
</form>
</body>
</html>
PHP Code:
<?php
$link=require ("Connection.php");
error_reporting(E_ALL); ini_set('display_errors', 1);
if(isset($_POST['Submit']))
{
$ICAO= mysqli_real_escape_string($link,$_POST['ICAO']);
$IATA= mysqli_real_escape_string($link,$_POST['IATA']);
$Airport_Name= mysqli_real_escape_string($link,$_POST['airport_name']);
$coordinates= mysqli_real_escape_string($link,$_POST['coordinates']);
$Time_zone_UTC= mysqli_real_escape_string($link,$_POST['Time_zone_UTC']);
$DST= mysqli_real_escape_string($link,$_POST['dst']);
$UTC= mysqli_real_escape_string($link,$_POST['utc']);
$from_date = mysqli_real_escape_string($link,$_POST['from_date']);
$to_date = mysqli_real_escape_string($link,$_POST['to_date'];
$country_code= mysqli_real_escape_string($link,$_POST['country_code']);
$remarks= mysqli_real_escape_string($link,$_POST['remarks']);
$Country= mysqli_real_escape_string($link,$_POST['country']);
//inserting records//
$sql="INSERT INTO airport_data (ICAO,IATA,Airport_name,Coordinates,Time_zone_utc,DST,UTC,From,To,Country_code,Remarks,Country) VALUES ('$ICAO','$IATA','$Airport_Name','$coordinates','$Time_zone_UTC','$DST','$UTC',STR_TO_DATE('$from_date', '%m/%d/%y'),STR_TO_DATE('$to_date', '%m/%d/%y'),'$country_code','$remarks','$Country')";
if(mysqli_query($link, $sql))
{
echo "Records added successfully.";
}
else
{
echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);
}
// close connection
mysqli_close($link);
}
?>
Here is the error I receive:
ERROR: Could not able to execute INSERT INTO airport_data (ICAO,IATA,Airport_name,Coordinates,Time_zone_utc,DST,UTC,From,To,Country_code,Remarks,Country) VALUES ('oprn','op','islamabad airport','islam','+9','other','+8',STR_TO_DATE('2015-05-26', '%m/%d/%y'),STR_TO_DATE('2015-05-20', '%m/%d/%y'),'op','p','Pakistan'). You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'From,To,Country_code,Remarks,Country) VALUES ('oprn','op','islamabad airport','i' at line 1
Escape (at least) reserved words in column names.
... `From`, `To`, ...
Full list of MySQL reserved words is in http://dev.mysql.com/doc/refman/5.6/en/reserved-words.html.
from and to are reserve keyword. Avoid to use them as column name. You need to change these column name.
You can find more details here
Actually the format of my date variables was wrong so i had to change it like
$from_date = new DateTime($_POST['from_date']);
$to_date = new DateTime($_POST['to_date']);
Insert the following into the database
$from_date = mysqli_real_escape_string($link, $from_date->format('Y-m-d'));
$to_date = mysqli_real_escape_string($link, $to_date->format('Y-m-d'));
And in query
some thing like
,'".$from_date."','".$to_date."',
This question already has answers here:
Apache is downloading php files instead of displaying them
(27 answers)
Closed 7 years ago.
I am trying to save form data to mysql database for last 2 days, however, the form data doesn't gets saved to mysql database, instead it downloads the User Info.php code file to my computer every time I press submit button. Need assistance!
This is html form;
<form class="form-horizontal" role="form" action="User Info.php" method="post"/>
<div class="form-group">
<label class="control-label col-sm-2" for="First Name">First Name:</label>
<div class="col-sm-10">
<input type="text" name="FirstName" class="form-control" id="First Name" placeholder="First Name">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="Last Name">Last Name:</label>
<div class="col-sm-10">
<input type="Last Name" name="LastName" class="form-control" id="Last Name" placeholder="Last Name">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="Company Name">Company Name:</label>
<div class="col-sm-10">
<input type="Company Name" name="CompanyName" class="form-control" id="Company Name" placeholder="Company Name">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="email">Email:</label>
<div class="col-sm-10">
<input type="Email" name="Email" class="form-control" id="Email" placeholder="Email">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="Message">Message</label>
<div class="col-sm-10">
<textarea type="Message" name="Message" class="form-control" rows="3" columns="50" id="Message" placeholder="Message"></textarea></div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button name="submit" class="submit-btn" type="submit">Submit</button>
This is php code db.php;
<?php
$conn = mysql_connect('localhost','root','....', 'testforlivesite') or die("error while connecting to the database");
$db = mysql_select_db('testforlivesite', $conn) or die("error while connecting to the database");
?>
User Info.php
<?php
include_once('db.php');
$FirstName = $_POST['FirstName'];
$LastName = $_POST['LastName'];
$CompanyName = $_POST['CompanyName'];
$Email = $_POST['Email'];
$Message = $_POST['Message'];
if(mysql_query("INSERT INTO ContactUs (FirstName, LastName, CompanyName, Email, Message) VALUES ('$FirstName', '$LastName', '$CompanyName', '$Email', '$Message')"))
echo "Thanks for contacting!";
else
echo "Please rewrite the message.";
?>
change your file name from User Info.php to UserInfo.php remove the space and also rename your file from User Info.php to UserInfo.php.
<form class="form-horizontal" role="form" action="UserInfo.php" method="post"/>
<div class="form-group">
<label class="control-label col-sm-2" for="First Name">First Name:</label>
<div class="col-sm-10">
<input type="text" name="FirstName" class="form-control" id="First Name" placeholder="First Name">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="Last Name">Last Name:</label>
<div class="col-sm-10">
<input type="Last Name" name="LastName" class="form-control" id="Last Name" placeholder="Last Name">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="Company Name">Company Name:</label>
<div class="col-sm-10">
<input type="Company Name" name="CompanyName" class="form-control" id="Company Name" placeholder="Company Name">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="email">Email:</label>
<div class="col-sm-10">
<input type="Email" name="Email" class="form-control" id="Email" placeholder="Email">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="Message">Message</label>
<div class="col-sm-10">
<textarea type="Message" name="Message" class="form-control" rows="3" columns="50" id="Message" placeholder="Message"></textarea></div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button name="submit" class="submit-btn" type="submit">Submit</button>