converting innerhtml result to php variable [duplicate] - Hack The Tech - Latest News related to Computer and Technology

Hack The Tech - Latest News related to Computer and Technology

Get Daily Latest News related to Computer and Technology and hack the world.

Saturday, May 20, 2023

converting innerhtml result to php variable [duplicate]

<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.



source https://stackoverflow.com/questions/76286397/converting-innerhtml-result-to-php-variable

No comments:

Post a Comment