QR Code Generator in PHP and Javascript
Mark E.
QR Code Generator JavaScript Library: This is a JavaScript library that can
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>QR Code Generator</title>
<script src="https://cdn.rawgit.com/davidshimjs/qrcodejs/gh-pages/qrcode.min.js"></script>
</head>
<body>
<h1>QR Code Generator</h1>
<div>
<label for="business-name">Business Name:</label>
<input type="text" id="business-name">
</div>
<div>
<label for="name">Name:</label>
<input type="text" id="name">
</div>
<div>
<label for="phone">Phone:</label>
<input type="text" id="phone">
</div>
<div>
<label for="website">Website:</label>
<input type="text" id="website">
</div>
<div>
<button onclick="generateQRCode()">Generate QR Code</button>
</div>
<div id="qrcode"></div>
<script>
function generateQRCode() {
// Get the user input
var businessName = document.getElementById('business-name').value;
var name = document.getElementById('name').value;
var phone = document.getElementById('phone').value;
var website = document.getElementById('website').value;
// Concatenate the data
var data = 'Business Name: ' + businessName + ', Name: ' + name + ', Phone: ' + phone + ', Website: ' + website;
// Generate the QR code
var qrcode = new QRCode(document.getElementById('qrcode'), {
text: data,
width: 256,
height: 256,
colorDark : '#000000',
colorLight : '#ffffff',
correctLevel : QRCode.CorrectLevel.H
});
}
</script>
</body>
</html>
This code generates a form with input fields for the user to enter the required data. When the "Generate QR Code" button is clicked, the library generates a QR code image and displays it on the page.