PHP Signature Pad Example | E-Signature Pad using Jquery Ajax and PHP

By Hardik Savani | February 8, 2020 | Category : PHP jQuery

Today, We will learn how to use e-signature pad using jquery ajax and php. i would like to give you example of php signature pad and save image to database. we will use jquery signature pad & canvas image.

You can easily use jquery ui signature pad and save image using PHP, Laravel and Codeigniter too.

In this example we will use keith-wood jquery ui signature pad for you can create your signature on it. we will take php form and submit that signature image and store that image into folder. you just have to just create bellow two files and you can get example.

So, let's create index.php and upload.php file with following instruction.

First of all, you need to download jquery signature js file from here: Download jquery.signature files.

After download, you need to create new folder "asset" and extract download zip file. put jquery.signature.min.js and jquery.signature.css files into asset folder.

You also need to create "upload" folder in your root directory. we will store image on that folder.


<!DOCTYPE html>



<title>PHP Signature Pad Example -</title>

<link rel="stylesheet" type="text/css" href="">

<script type="text/javascript" src=""></script>

<link type="text/css" href="" rel="stylesheet">

<script type="text/javascript" src=""></script>

<script type="text/javascript" src="asset/jquery.signature.min.js"></script>

<link rel="stylesheet" type="text/css" href="asset/jquery.signature.css">


.kbw-signature { width: 400px; height: 200px;}

#sig canvas{

width: 100% !important;

height: auto;





<div class="container">

<form method="POST" action="upload.php">

<h1>PHP Signature Pad Example -</h1>

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

<label class="" for="">Signature:</label>


<div id="sig" ></div>


<button id="clear">Clear Signature</button>

<textarea id="signature64" name="signed" style="display: none"></textarea>



<button class="btn btn-success">Submit</button>



<script type="text/javascript">

var sig = $('#sig').signature({syncField: '#signature64', syncFormat: 'PNG'});

$('#clear').click(function(e) {










$folderPath = "upload/";

$image_parts = explode(";base64,", $_POST['signed']);

$image_type_aux = explode("image/", $image_parts[0]);

$image_type = $image_type_aux[1];

$image_base64 = base64_decode($image_parts[1]);

$file = $folderPath . uniqid() . '.'.$image_type;

file_put_contents($file, $image_base64);

echo "Signature Uploaded Successfully.";


I hope it can help you...

Tags : jQuery PHP

Hardik Savani
My name is Hardik Savani. I'm a full-stack developer, entrepreneur and owner of Aatman Infotech. I live in India and I love to write tutorials and tips that can help to other artisan. I am a big fan of PHP, Javascript, JQuery, Laravel, Codeigniter, VueJS, AngularJS and Bootstrap from the early stage.
Follow Me: Github Twitter
***Do you want me hire for your Project Work? Then Contact US.

We are Recommending you: