Skip to Content
Code Build QR Code Generator with PHP and Ajax
php code / September 8, 2018

Step By Step
NOTE :- library Used  phpqrcode Download

Step 1 :- Created header.php

<!DOCTYPE html>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />
<link rel=”stylesheet” href=””>
<link rel=”stylesheet” href=””>
<script src=””></script>
<script src=””></script>
<!– jQuery –>

Step 2 :- Created footer.php

<div class=”insert-post-ads1″ style=”margin-top:20px;”>


Step 3 :Created container.php

<body class=””>
<div role=”navigation” class=”navbar navbar-default navbar-static-top”>
<div class=”container”>
<div class=”navbar-header”>
<button data-target=”.navbar-collapse” data-toggle=”collapse” class=”navbar-toggle” type=”button”>
<span class=”sr-only”>Toggle navigation</span>
<span class=”icon-bar”></span>
<span class=”icon-bar”></span>
<span class=”icon-bar”></span>
<a href=”” class=”navbar-brand”>PHPCODE</a>
<div class=”navbar-collapse collapse”>
<ul class=”nav navbar-nav”>
<li class=”active”><a href=””>Home</a></li>


</div><!–/.nav-collapse –>

<div class=”container” style=”min-height:500px;”>
<div class=”>

Step 4 :- Created index.php

<title>phpcode : Code Build QR Code Generator with PHP and Ajax</title>
<link rel=”stylesheet” href=”css/style.css”>
<script src=”script/ajax_generate_code.js”></script>
<?php include(‘container.php’);?>
<div class=”container”>
<div class=”row”>
<h2>Example: Build QR Code Generator with PHP and Ajax</div>
<div class=”col-md-3″>
        <form class=”form-horizontal” method=”post” id=”codeForm” onsubmit=”return false”>
            <div class=”form-group”>
            <label class=”control-label”>Code Content : </label>
            <input class=”form-control col-xs-1″ id=”content” type=”text” required=”required”>
            <div class=”form-group”>
            <label class=”control-label”>Code Level (ECC) : </label>
            <select class=”form-control col-xs-10″ id=”ecc”>
            <option value=”H”>H – best</option>
            <option value=”M”>M</option>
            <option value=”Q”>Q</option>
            <option value=”L”>L – smallest</option>       
            <div class=”form-group”>
            <label class=”control-label”>Size : </label>
            <input type=”number” min=”1″ max=”10″ step=”1″ class=”form-control col-xs-10″ id=”size” value=”5″>
            <div class=”form-group”>
            <label class=”control-label”></label>
            <input type=”submit” name=”submit” id=”submit” class=”btn btn-success” value=”Generate QR Code”>
    <div class=”col-md-6″>
    <div class=”showQRCode”></div>
<?php include(‘footer.php’);?>

Step 5 :- Created generate_code.php

if(isset($_POST) && !empty($_POST)) {
$codesDir = “codes/”;
$codeFile = date(‘d-m-Y-h-i-s’).’.png’;
$formData = $_POST[‘formData’];
// generating QR code
QRcode::png($formData, $codesDir.$codeFile, $_POST[‘ecc’], $_POST[‘size’]);
// display generated QR code
echo ‘<img class=”img-thumbnail” src=”‘.$codesDir.$codeFile.'” />’;
} else {


Best view i have ever seen !

yppyezrgyh says:

Code Build QR Code Generator with PHP and Ajax – PHPCODE

Leave a Reply

Your email address will not be published.

PHPCODE © 2023