Download cleaning invoice pdf and use

Currently, the demand for searching for cleaning invoice pdf  is very huge. Because when using it, you just need to fill in available forms, then print and give them to your customers. The advantage of the pdf file compared with other format texts is that it can be edited by browsers without installing any software.

cleaning invoice pdf

Depending on your demand as well as the field you are working in, you should choose a suitable cleaning invoice pdf template. You can only edit the information of these pdf template files without changing their structures. The advantage of this file type is that you can create the consistency in the invoice in order to maintain your brand. However, this also is the disadvantage because you cannot make a custom, which may reduce your personalization as well as creativity.

These are pdf files which are shared for you to use for free. It is suitable for everyone. It is sure that every people can use them on all devices. There will be no hope anymore.

The usage is quite simple, you could download the pdf file here  or get access to this link

Please input necessary information which are your information or the store information, for instance, name, address, customer’s information, shipping address.

In order detail, please enter product’s name, quantity, price per unit for each product and the percentage of discount. The system will automatically calculate the total amount. You do not have to calculate anything at all, which will reduce the error of doing this manually.

Thank website https://invoicetemplates.com  for sharing this resource for free.

In the previous part, we can create an invoice template bootstrap. If this article, as well as cleaning invoice pdf file, is useful for you, please sharing it so that more and more people have a chance to know about this free invoice file. Thanks you so much.

Moving company invoice pdf for free

You are able to use this file for free. The only things you need to do are downloading this file and inputting all the required information. This pdf file is quite special because you can edit it with different software. You can open it on many browsers which are available in your device such as Google Chrome, Firefox, IE, etc. and click on Print button to print invoices.

moving company invoice pdf

Required information on moving company invoice pdf for free

Similarly to all other invoices, you should input some related information such as your company’s name, address, and contact information like telephone number, and email. Besides, you should enter information of the company to which you send the moving company invoice pdf.

In the below part of the invoice, you should input all the tasks you have completed so that your partner will carry out the payment for you. Or you could also input the product information you have sold to your customers. Depending on your nation orstate imposing the tax on your products or not, you should include this tax on the invoice.

Do I need to send moving company invoice pdf always?

To me, you should always send the invoice to your customers so that you can have a statistic of how many products are sold and how many profits you receive. This feature is so helpful if you want to summarize all the profits and loss or the operating performance of your company.

In the previous part, we can create an  invoice template bootstrap. In this one, you do not have to edit anything or create code. You just need to click and experience. If you have demand for the invoice, you could download this file here

How to create invoice template bootstrap 

invoice template bootstrap is  the invoice template built on html, and css. Besides, the bootstrap library supports to create attractive and responsive invoices more easily. In this article, we will build an invoice step by step.

Idea

This simple invoice template will include the main information as below:

Invoice logo: This can be your company’s logo. You add it in order to promote your brand image.

Invoice number: This number is to distinguish one invoice with the others.

BILLING ADDRESS:  This is the address of goods’ sender

DELIVERY ADDRESS:  This is the address of goods’ receiver

Order detail: This includes product information such as name, quantity, price, shipping amount and a total amount of the invoice.

We will build an invoice template bootstrap being the same as the one in the below figure. Note that this is a simple example, you can absolutely create a more attractive invoice based on it because your creativity is unlimited.

invoice template bootstrap

Preparation

  • Install the editor software which is the most suitable for you such as php designer, notepad++, etc.
  • Download bootstrap library here  and unzip it
  • Download font awesome library here and unzip it

Implementation

Implement as the following order:

Step 1: Create the folder: invoice- template-bootstrap

Step 2: Copy the unzipped bootstrap folder and paste here: invoice- template- bootstrap

Step 3: Copy the unzipped font-awesome folder and paste in invoice- template- bootstrap

Step 4: In invoice- template- bootstrap, create a css folder. In the css folder, create style.css file. Make sure to create the exact following URL: invoice- template- bootstrap/css/style.css

Step 5: Open css file created in step 3 and add and save the below contents to style.css file.


.height {
min-height: 200px;
}
.icon {
font-size: 47px;
color: #5CB85C;
}
.iconbig {
font-size: 77px;
color: #5CB85C;
}

.table >tbody>tr> .emptyrow {
border-top: none;
}

.table >thead>tr> .emptyrow {
border-bottom: none;
}
.table >tbody>tr> .highrow {
border-top: 3px solid;
}
.logo img {width:100px}
.top-header {padding: 15px 0}

Step 6: Create index.html file in root folder of invoice- template- bootstrap

As the same time, make sure that invoice- template- bootstrap folder has the same structure as the figure below:

invoice template bootstrap

Step 7: Open index.html file, input and save the following contents


<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="author" content="TRAN DINH HONG" />
<title>Simple Invoice Template | PrepBootstrap</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" type="text/css" href="bootstrap/css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="font-awesome/css/font-awesome.min.css" />
<link rel="stylesheet" type="text/css" href="css/style.css" />
</head>
<body>
<div class="container">
<div class="container">
<div class="row">
<div class="col-xs-12">
<div class="row top-header">
<div class="col-xs-2 col-md-3 col-lg-3 pull-left">
<a class="logo" href=""><img src="http://nikrasam.com/media/catalog/product/ct_a683348e01.png" /></a>
</div>
<div class="col-xs-10 col-md-9 col-lg-9 ">
<h2>Invoice number #6789</h2>
</div>
</div>
<hr>
<div class="row">
<div class="col-xs-12 col-md-3 col-lg-3 pull-left">
<div class="panel panel-default height">
<div class="panel-heading">BILLING ADDRESS</div>
<div class="panel-body">
<strong>John DOE</strong><br>
16, Main street 2nd floor<br>
Miami - 33133 Florida<br>
<strong>0102030405</strong><br>
</div>
</div>
</div>
<div class="col-xs-12 col-md-3 col-lg-3 ">
<div class="panel panel-default height">
<div class="panel-heading">DELIVERY ADDRESS</div>
<div class="panel-body">
<strong>John DOE</strong><br>
16, Main street 2nd floor<br>
Miami - 33133 Florida<br>
<strong>0102030405</strong><br>
</div>
</div>
</div>
<div class="col-xs-12 col-md-3 col-lg-3">
<div class="panel panel-default height">
<div class="panel-heading">PAYMENT INFORMATION</div>
<div class="panel-body">
<strong>Card Name:</strong> Master Cart<br>
<strong>Card Number:</strong> ***** 556<br>
<strong>Exp Date:</strong> 08/22<br>
</div>
</div>
</div>
<div class="col-xs-12 col-md-3 col-lg-3">
<div class="panel panel-default height">
<div class="panel-heading">ORDER PREFERENCES</div>
<div class="panel-body">
<strong>Gift:</strong> No<br>
<strong>Express Delivery:</strong> Yes<br>
<strong>Insurance:</strong> No<br>
<strong>Coupon:</strong> No<br>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="text-center"><strong>Order summary</strong></h3>
</div>
<div class="panel-body">
<div class="table-responsive">
<table class="table table-condensed">
<thead>
<tr>
<td><strong>Item Name</strong></td>
<td class="text-center"><strong>Item Price</strong></td>
<td class="text-center"><strong>Item Quantity</strong></td>
<td class="text-right"><strong>Total</strong></td>
</tr>
</thead>
<tbody>
<tr>
 

Now, you try running it on the browser, the result will be as the first figure. Its advantage is that it could be responsive with different screen sizes due to using Bootstrap library. In fact, using Bootstrap is seldom because most users do not know about programming. Therefore, many supporting tools which make people not have to calculate manually anymore appear. For instance, Pdf Invoice Template is the tool installed in Prestashop source code to support store owners to easily create their own invoices. You could try the demo here. I believe that with its wonderful features, you can save a lot of time spent on processing invoices.

How to create java dropdown menus in website

Java is not only specially used in building apps but also applied to the website development. In this field, we could also talk about JSP language which is used by many big businesses. The article java dropdown menus will help you create a simple menu with this source code.

java dropdown menus

Preparation

Users who use java language for programming should prepare tomcat server. This server is different from the servers exclusively used for PHP and ASP. The java faithful often use exclusive editor software such as eclipse or netbean ide. In the article java dropdown menus, we just need one editor and one browser to check.

Implementation

No matter which language you use to develop your websites, html and css are the two compulsory things you must know. No matter which source code you use, html source code can work well with this. Therefore, you should be skillful in html. You can easily make changes to create an appropriate menu. The code of the menu will be as below

<style>
.dropbtn {
background-color: #4CAF50;
color: white;
padding: 16px;
font-size: 16px;
border: none;
}
.dropdown {
position: relative;
display: inline-block;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #f1f1f1;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 1;
}
.dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
}
.dropdown-content a:hover {background-color: #ddd;}
.dropdown:hover .dropdown-content {display: block;}
.dropdown:hover .dropbtn {background-color: #3e8e41;}
</style>
</head>
<body>

<h2>Hoverable Dropdown</h2>
<p>Move the mouse over the button to open the dropdown menu.</p>
<div class="dropdown">
<button class="dropbtn">Dropdown</button>
<div class="dropdown-content">
<a href="#">Link 1</a>
<a href="#">Link 2</a>
<a href="#">Link 3</a>
</div>
</div>
 
</body>

Thus, we have just finished the article java dropdown menus. Hope that you can create more impressive and attractive menus than that in this article. This article just guides you on creating a menu manually. If you want to create menus in your projects, there will be mega menu modules to support you. When using these modules, you do not need to know about code because you just need to get to the backend, and drag and drop.

Mega menu prestashop 1.6 free and & Premium

The article mega menu prestashop 1.6 free and & Premium focuses on the two greatest mega menu modules that I have ever used. It will make you less surprised and confused when applying the modules to your projects. Depending on each demand, you should choose the suitable mega menu. In this article, the advantages of the module are showcased based on my subjective evaluations.

1 Prestashop Vertical dropdown categories

It is the first mega menu prestashop 1.6 free introduced. The order of menus in the list is the order that the author tests menus and it does not relate to the quality of the menus. A good news for you is that these menus and the next menu versions are guaranteed to work well on both Prestashop 1.6 and 1.7

The most important and mainstream feature of the module is the ability to display categories in the form of dropdown. Submenus of the menu items appear on hover.

It allows to configure the depth of the menu and to add images to the menu as well.

For more information about the mega menu, please refer to this link:  https://mypresta.eu/modules/front-office-features/vertical-dropdown-categories-menu.html

mega menu prestashop 1.6 free

2 Mega Menu Builder Module

This is a premiummenu module. However, you should not mind it because it is worth investing in. The fruit you benefit from it outweighs the cost you spend.

When using this module, your menus are styled attractively, and responsive with different screen sizes such as PC, tablet, and mobile phone.

Besides, the submenus have the following features

Drop down tree menu: It allows you to create multi-level submenus. A tree menu is perfect if you have multiple collections, multi-product categories. The module supports creatingan unlimited number of submenu levels.

Tabbed Submenus: This is a perfect menu type for your customer to discover your products, featured collection… etc. You can use dynamic contents (product, collection) or static contents (HTML, Image) for the tab menu.

Links list, links block: Links list is useful for your customer to discover multiple collections, for example, the site. You can set block width, height, number.

Featured products: Increase your sale by displaying your featured product on the menu. Globo Mega Menu supports displaying products on your menu.

Contact Form – Add contact form directly on the menu. Help your customer easily keep in touch with your store.

For more information about the mega menu builder, please refer to this link:  https://addons.prestashop.com/en/menu/29701-mega-menu-builder.html

 

 

The article mega menu prestashop 1.6 free and & Premium talks about my user experience after using the two free and premium modules. How about your opinion of Prestashop modules? Please let us know.

 

Custom fields Prestashop module

Custom fields Prestashop is the module that allows you to add extra fields to a registration form, and checkout page. The module supports all input types, which helps you to create forms with various fields meeting your needs.

Custom fields Prestashop

DRAG AND DROP SUPPORT

In addition, it will be easier than ever for form creation because custom fields module supports for drag and drop. According to statistics, a huge number of users enjoy using drag and drop due to its friendly, visual user interface and time saving.

EASY TO ADD FIELDS TO REGISTRATION FORM

You can add extra fields to a registration page by using drag and drop in the Pretashop registration form of the module’s back office. After registering, customers are able to edit their information and data in item “my account”. In terms of admin, they can change all data about their customers in the back office. Especially, you can choose the place where to locate fields in the registration page.

ADD EXTRA FIELDS TO SHIPPING STEP OF THE CHECKOUT PAGE

In checkout page, you are able to add extra fields to shipping step. This process’s purpose is to collect customer information that is used in the delivery processin order to make sure the most convenient delivery for both store owners, delivery units, and customers.

ADD EXTRA FIELDS TO PAYMENT STEP OF THE CHECKOUT PAGE

Being similar to shipping step, custom fields Prestashop module also supports to create form and display fields in payment step, serving store and shop owners who enjoy editing form themselves.

If you are owninga shop website built on Prestashop platform but you feel that the default registration part of the system still has not met your needs yet. Or you want to edit, add extra fields to checkout step, shipping step, etc. I believe you should consider using this module. Please visit here  . Or if you have any question, do not hesitate to contact us. We are willing to support you.

How to create sticky form in php

Sticky form in PHP is a standard HTML form which saves that data have been entered in a form. It’s really helpful for end-user because they don’t need to re-type data into the form if there’s an error while submitting. Let me give you a real example. When you search in google, the search results are displayed below, while texts still appear in the search box

Sticky form in PHP

 

In the previous posts, we have created PHP code to send email as well as display form data, so we will directly create a simple sticky form in PHP in this tutorial. You can see the demo here.

To create this sticky form, we have to follow 2 steps:

  • Step 1: Taking the data sent by the form by using “GET” method: $data= $_GET[“data”];
  • Step 2: Settings that data as a value for input

By default, the form data will be removed after submitting because of this code line: <input name =”data” value=”” />)

We need to change this code to: <input type=”text” name=”data” value=”<?php echo $data; ?>”>

Source code:

At first, put the sticky-form-in-php folder inside \htdocs folder (if you use xampp). In the sticky-form-in-php folder, create index.php file.


<!doctype html>
<html>
<body>
<?php
if (isset($_GET["data"])){
$data= $_GET["data"];
}
else {
$data= "";
}
<form method="GET" >
Enter content: <input type="text" name="data" value="<?php echo $data; ?>">
<button type="submit">Submit</button>
</form>
 
<?php
if (isset($_GET["data"])){
echo  $data = $_GET["data"];
}
?>
</body>
</html>
</code></pre>
 
Let’s discuss about these codes:
<pre><code class="php">
<?php
if (isset($_GET["data"])){
$data= $_GET["data"];
}
else {
$data= "";
}

These piece of codes means that when client add data to the form fields, the system will assign those values to the data variable. If not, the data variable has an empty value.

In case we don’t provide those conditions, the system will display an error if a user leaves an empty field:

 

Sticky form in PHP

The below code line uses for display textbox data that we have taken from the above step:


<input type="text" name="data" value="<?php echo $data; ?>">

The purpose of these codes is displaying data that’s been entered:

<?php
if (isset($_GET["data"])){
echo  $data = $_GET["data"];
}
?>

We hope that you can know how does the sticky form in PHP work through our tutorial. You can download our source code for reference. We also create a video demo so you can fully understand the steps to create a sticky form. If you need to add form validate you could follow the post.

If you’ve any question or recommendation, please do not hesitate to let us know.

How to create PHP contact form script with captcha

In the two previous posts, we have successfully created a simple contact form with validation for fields. It can’t be denied that a lot of spammers and programmed spambots will attack your website from flooding your form, that’s the reason why your contact form needs a CAPTCHA function to prevent those spam emails. By using captcha function, a customer needs to enter correct provided characters into the captcha box so that they can submit his request to the server. In this article, I will guide you how to create the PHP contact form script with captcha.

PHP contact form script with captcha

We will create contact-us.php file instead of HTML file. You need to put this .php file into the project folder.

Source code of PHP contact form script with captcha:


<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="content-type" content="text/html" />
<meta name="author" content="TRAN DINH HONG" />
<title>php code to send email from contact form</title>
<link type="text/css" rel="stylesheet" href="style/style.css" />
</head>
 
<body>
<?php
session_start();
 
include("php/simple-php-captcha/simple-php-captcha.php");
// Step 1 - Enter your email address below.
$to = 'you@domain.com';
 
if(isset($_POST['emailSent'])) {
 
$subject = $_POST['subject'];
 
// Step 2 - If you don't want a "captcha" verification, remove that IF.
if (strtolower($_POST["captcha"]) == strtolower($_SESSION['captcha']['code'])) {
 
$name = $_POST['name'];
$email = $_POST['email'];
 
// Step 3 - Configure the fields list that you want to receive on the email.
$fields = array(
0 => array(
'text' => 'Name',
'val' => $_POST['name']
),
1 => array(
'text' => 'Email address',
'val' => $_POST['email']
),
2 => array(
'text' => 'Message',
'val' => $_POST['message']
),
3 => array(
'text' => 'Checkboxes',
'val' => implode($_POST['checkboxes'], ", ")
),
4 => array(
'text' => 'Radios',
'val' => $_POST['radios']
)
);
 
$message = "";
 
foreach($fields as $field) {
$message .= $field['text'].": " . htmlspecialchars($field['val'], ENT_QUOTES) . "<br>\n";
}
 
$mail = new PHPMailer;
$mail->From = $email;
$mail->FromName = $_POST['name'];
$mail->AddAddress($to);
$mail->AddReplyTo($email, $name);
 
$mail->IsHTML(true);
 
$mail->CharSet = 'UTF-8';
 
$mail->Subject = $subject;
$mail->Body    = $message;
 

// Step 5 - If you don't want to attach any files, remove that code below

if (isset($_FILES['attachment']) && $_FILES['attachment']['error'] == UPLOAD_ERR_OK) {
$mail->AddAttachment($_FILES['attachment']['tmp_name'], $_FILES['attachment']['name']);
}
 
if($mail->Send()) {
$arrResult = array('response'=> 'success');
} else {
$arrResult = array('response'=> 'error', 'error'=> $mail->ErrorInfo);
}
 
} else {
 
$arrResult['response'] = 'captchaError';
 
}
 
}
?>
 
<div class="contact-wapper">
<h2 class="title"><strong>Contact</strong> Us</h2>

<form id="contactForm" action="<?php echo basename($_SERVER['PHP_SELF']); ?>#contact-sent" method="POST" >

<div class="row">

<div class="form-group">

<div class="col-md-6">

<label>Your name *</label>

<input type="text" value="" msg-error="Please enter your name here."  maxlength="100" class="form-control" name="name" id="name" required="" aria-required="true">

</div>

<div class="col-md-6">

<label>Your email address *</label>

<input type="email" value="" msg-error="Please enter your email address here."  maxlength="100" class="form-control" name="email" id="email" required="" aria-required="true">

</div>

</div>

</div>

<div class="row">

<div class="form-group">

<div class="col-md-12">

<label>Subject</label>

<input type="text" value="" msg-error="Please enter your subject  here."  maxlength="100" class="form-control" name="subject" id="subject" required="" aria-required="true">

</div>

</div>

</div>

<div class="row">

<div class="form-group">

<div class="col-md-12">

<label>Message *</label>

<textarea maxlength="5000" rows="10" msg-error="Please enter your message  here." class="form-control" name="message" id="message"  required="" aria-required="true"></textarea>

</div>

</div>

</div>

<div class="row">

<div class="col-md-12">

<label>Capcha code*</label>

</div>

</div>

<div class="row">

<div class="form-group capcha-s">

<div class="col-md-4">

<div class="captcha form-control">

<div class="captcha-image">

<?php

$_SESSION['captcha'] = simple_php_captcha(array(

'min_length' => 6,

'max_length' => 6,

'min_font_size' => 22,

'max_font_size' => 22,

'angle_max' => 3

));
$_SESSION['captchaCode'] = $_SESSION['captcha']['code'];
echo '<img id="captcha-image" src="' . "php/simple-php-captcha/simple-php-captcha.php/" . $_SESSION['captcha']['image_src'] . '" alt="CAPTCHA code">';
?>
</div>
<div class="captcha-refresh">
<a href="#" id="refreshCaptcha"><i class="fa fa-refresh"></i></a>
</div>
</div>
</div>
<div class="col-md-8">
<input type="text" value="" maxlength="6" data-msg-captcha="Wrong verification code." data-msg-required="Please enter the verification code." placeholder="Type capcha code." class="form-control input-lg captcha-input" name="captcha" id="captcha" required>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<input type="submit" value="Send Message" class="btn btn-primary btn-lg mb-xlg" />
</div>
</div>
</form>
</div>
</body>
</html>

Please take note about this important code line: “include(“php/simple-php-captcha/simple-php-captcha.php”);”. This means we need to use the PHP captcha library to automatically generate captcha code for each customer if we develop the PHP contact form script with captcha.

In this article, we talk about the basic things that help you understand how it works. In reality, you can base on this article to learn how to add a library to create the captcha function. Because the contents of the library are so long and complicated that users who start to learn about form find it difficult to understand, we will talk about it in another article.

You shouldn’t follow the post if you are using a framework like WordPress, Prestashop or Magento. Because the frameworks has awsome plugins, modules for creating form. For example, If you need custom Prestashop contact form, you could use module Form Builder Pro.

There are many types of captcha that can be used. We will discuss one captcha type in this article. Besides, another interesting way is using Google captcha. Basically, we need to register to get API of Google then add this API to the form settings in order o be able to use.

you can download Source code : PHP-contact form-script-with-captcha

If you’ve any question or recommendation, please do not hesitate to let us know.

 

PHP contact form script with validation

This tutorial gives you guidance to create the PHP contact form script with validation. In the previous post, we have guide developing the PHP code to send email from contact form and have successfully created a simple contact form. But this contact form lacks the data validation step. As you know, the form you create will include a lot type of inputs such as text fields, radio buttons, a multiple-option select list, a checkbox, and a submit button. You need to validate those fields to ensure that customers enter a valid value. This article will help you to add validation to the PHP form

There have 2 ways to validate fields: using HTML 5 and using Javascript.

Validation contact form using HTML 5

When using HTML 5, a warning message will appear if a customer clicks on the Submit button while they do not fill in value for the required fields.

PHP contact form script with validation

You need to add this code into input tag: required=”” aria-required=”true”. Please refer to the below screenshot:

PHP contact form script with validation
Code HTML


<div class="contact-wapper">
<h2 class="title"><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="" maxlength="100" class="form-control" name="name" id="name" required="" aria-required="true">
</div>
<div class="col-md-6">
<label>Your email address *</label>
<input type="email" value="" maxlength="100" class="form-control" name="email" id="email" required="" aria-required="true">
</div>
</div>
</div>
<div class="row">
<div class="form-group">
<div class="col-md-12">
<label>Subject</label>
<input type="text" value="" maxlength="100" class="form-control" name="subject" id="subject" required="" aria-required="true">
</div>
</div>
</div>
<div class="row">
<div class="form-group">
<div class="col-md-12">
<label>Message *</label>
<textarea maxlength="5000" rows="10" class="form-control" name="message" id="message" required="" aria-required="true"></textarea>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<input type="submit" value="Send Message" class="btn btn-primary btn-lg mb-xlg" />
</div>
</div>
</form>
</div>

Validate contact form using javascript

Developers usually use javascript for creating the PHP contact form script with validation because of multiple advantages. The data validation and processing are faster than using HTML 5 because it reduces the number of requests to the server. Besides, developers can easily add/remove classes and javascript event. An example of using javascript is as below contact form:

 

PHP contact form script with validation

In the HTML file, please add these codes:

PHP contact form script with validation

The content of the warning message can be put after the msg-error= code.

Please refer to the below code html


<div class="row">
<div class="form-group">
<div class="col-md-6">
<label>Your name *</label>
<input type="text" value="" msg-error="Please enter your name here." maxlength="100" class="form-control" name="name" id="name" required="" aria-required="true">
</div>
<div class="col-md-6">
<label>Your email address *</label>
<input type="email" value="" msg-error="Please enter your email address here." maxlength="100" class="form-control" name="email" id="email" required="" aria-required="true">
</div>
</div>
</div>
<div class="row">
<div class="form-group">
<div class="col-md-12">
<label>Subject</label>
<input type="text" value="" msg-error="Please enter your subject here" maxlength="100" class="form-control" name="subject" id="subject" required="" aria-required="true">
</div>
</div>
</div>

 

 

This is code javaScrip


jQuery('.btn-primary').click(function(){
  jQuery("#contactForm input").each(function() {
    if (jQuery(this).val() =="" ){
      jQuery(this).parent().append('<div class="red">'+jQuery(this).attr('msg-error')+'</div>');
   }
  });
})

Download code PHP contact form script with validation via html5  dowload code contact form here

Download code php contact form validation via javascript: php-code-to-send-email-from-contact-form-via-javascrip

 

php code to send email from contact form 2018

In our contact form serial, we will give you detailed instructions about developing PHP code to send email from contact form.

Your contact from will look like the screenshot

php code to send email from contact form

 

In this post, we will create a contact form with the similar layout. The purpose of this tutorial is making the PHP script sent email from web form and sending email function work correctly. If you want to change the contact form layout, you can put your style code into the style.css file in the style folder.

In order to create a contact form, we will need those file types:

  • HTML file (.html): HTML source codes are used for creating contact page layout such as displaying textbox, submit button, etc.
  • CSS file (.css): CSS codes are used for managing box position, font, font color, and so on.
  • PHP file (.php): PHP codes are used for data processing

Now, let’s get started to develop code send mail php for a simple contact form. One contact form usually includes these fields:

  • Username: A visitor needs to fill in his/her name in this field
  • Email: This field represents visitor’s email address
  • Subject: This field represents the email’s subject
  • Message: This field represents the content of the email
  • Submit button

These fields are necessary to create a simple php email form. You can add other fields to your contact form later.

If your website uses Prestashop platform, I strongly recommend that you should use the Form Builder module to create your unique contact form. You can check the module here: https://addons.prestashop.com/en/contact-forms-surveys/22563-form-builder-custom-contact-product-cms-quote-form.html

Step 1: Create HTML contact form: contactform.html


<div class="contact-wapper">
 <h2 class="title"><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="" maxlength="100" class="form-control" name="name" id="name" required="" aria-required="true">
 </div>
 <div class="col-md-6">
 <label>Your email address *</label>
 <input type="email" value="" maxlength="100" class="form-control" name="email" id="email" required="" aria-required="true">
 </div>
 </div>
 </div>
 <div class="row">
 <div class="form-group">
 <div class="col-md-12">
 <label>Subject</label>
 <input type="text" value="" maxlength="100" class="form-control" name="subject" id="subject" required="" aria-required="true">
 </div>
 </div>
 </div>
 <div class="row">
 <div class="form-group">
 <div class="col-md-12">
 <label>Message *</label>
 <textarea maxlength="5000" rows="10" class="form-control" name="message" id="message" required="" aria-required="true"></textarea>
 </div>
 </div>
 </div>
 <div class="row">
 <div class="col-md-12">
 <input type="submit" value="Send Message" class="btn btn-primary btn-lg mb-xlg" />
 </div>
 </div>
 </form>
</div>

Step 2: Style CSS for contact form: style.css

In the project folder, you have to create a new  styles folder. In this new folder, create a CSS file: style.css. Source code:


*{box-sizing: border-box;}

.col-md-6 {

width: 50%;

float: left;

padding: 0 15px;

}

.col-md-12{width:100%;float:left;padding:0 15px}

label {

display: inline-block;

max-width: 100%;

margin-bottom: 8px;

font-weight: bold;

}

.form-control {

display: block;

width: 100%;

height: 34px;

padding: 6px 12px;

font-size: 14px;

line-height: 1.42857143;

color: #555;

background-color: #fff;

background-image: none;

border: 1px solid #ccc;

border-radius: 4px;

-webkit-box-shadow: inset 0 1px 1pxrgba(0, 0, 0, .075);

box-shadow: inset 0 1px 1pxrgba(0, 0, 0, .075);

-webkit-transition: border-color ease-in-out .15s, -webkit-box-shadow ease-in-out .15s;

-o-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;

transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;

}

.form-group {

width: 100%;

float: left;

padding: 15px 0;

}

.contact-wapper {

width: 40%;

margin: auto;

}

h2.title {

padding: 0 15px;

}

textarea#message {

height: auto;

}

input.btn.btn-primary.btn-lg.mb-xlg {

color: #fff;

background-color: #204d74;

border-color: #122b40;

height: 30px;

border: none;

}

Go back to the contactform.html file, please put these codes inside the <header></header> tag:

<link type=”text/css” rel=”stylesheet” href=”style/style.css” />

Step 3: Write php code to send email from html contact from

Source code:


<?php

session_cache_limiter('nocache');

header('Expires: ' . gmdate('r', 0));

header('Content-type: application/json');

$to = 'you@domain.com';

$subject = $_POST['subject'];

if(isset($_POST['email'])) {

$name = $_POST['name'];

$email = $_POST['email'];

$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";

}

$headers = '';

$headers .= 'From: ' . $name . ' <' . $email . '>' . "\r\n";

$headers .= "Reply-To: " .  $email . "\r\n";

$headers .= "MIME-Version: 1.0\r\n";

$headers .= "Content-Type: text/html; charset=UTF-8\r\n";

if (mail($to, $subject, $message, $headers)){

$arrResult = array ('response'=>'success');

} else{

$arrResult = array ('response'=>'error');

}

echojson_encode($arrResult);

} else {

$arrResult = array ('response'=>'error');

echojson_encode($arrResult);

}

?>

In order to change the received email address, you need to replace you@domain.com to the expected email address in this code line: $to = ‘you@domain.com’.

All are done. If you still have trouble in creating a contact form, please check our video instruction.

You can download code project PHP code to send email from a contact form here

In this tutorial, we use the default PHP mail function. This function works with almost all hostings, but if your hosting blocks it, you should contact them to enable it for your website or you can create PHP code to send email from contact form via SMTP.