<script>
scanner.render(success, error);
// Starts scanner
function success(result) {
let today = new Date().toISOString().slice(0, 10)
const date_obj = new Date();
time = new Date().toLocaleTimeString();
document.getElementById('result').innerHTML = `
<div class="card" style="width: 25rem; onload="console_log(${result};">
<img src="../assets/img/barcode-scan.gif" class="card-img-top" alt="...">
<div class="card-body">
<form action="index.php?page=validator" method="post">
```
<?php
include '../pages/koneksi.php';
$result=${result};
$result_explode = explode($result);
$e_result1=$result_explode[1];
$new2="SELECT * FROM `barang` WHERE Barcode=$result";
$res2=mysqli_query($koneksi, $new2);
while($row=mysqli_fetch_array($res2)){
echo $row['Nama'];
echo $result;
}
?>
```
</script>
I Want to get data from ${result} converting to $result, to get MySQL data
using where Barcode=$result.
But I didn't get something,
but when I change the Barcode=$result to data basic like Barcode=0101011
,
then I get the value of the echo result as the scanned barcode.
Please give me a favor.. thanks.