Jump to content

PHP data matching dropdown with qr code scan

Recommended Posts

Good morning.
I'm doing this project but I'm stuck when the app need to match the dropdown result with the scan result of qr code.
What should I do?

Thanks in advance to everyone. 

<!doctype html>
<html dir=ltr style="overflow-x: hidden;padding: 0px;width: 100%;">
<meta charset=utf-8>
<meta http-equiv=X-UA-Compatible content="IE=edge">
<meta name=viewport content="width=device-width, initial-scale=1">
  <meta name="description" content="">
  <meta name="author" content="SoftMat">
<link media="all" href="css/style.css" rel="stylesheet" />
<!-- qrcode-reader core CSS file -->
<link rel="stylesheet" href="css/qrcode-reader.min.css">
<!-- jQuery -->
<script src="js/jquery.min.js"></script>
<!-- qrcode-reader core JS file -->
<script src="js/qrcode-reader.min.js"></script> 

    // overriding path of JS script and audio 
    $.qrCodeReader.jsQRpath = "js/jsQR.min.js";
    $.qrCodeReader.beepPath = "audio/sound.mp3";  

    // bind all elements of a given class

    // bind elements by ID with specific options
    $("#openreader-multi2").qrCodeReader({multiple: true, target: "#multiple2", skipDuplicates: false});
    $("#openreader-multi3").qrCodeReader({multiple: true, target: "#multiple3"});

    // read or follow qrcode depending on the content of the target input
    $("#openreader-single2").qrCodeReader({callback: function(code) {
      if (code) {
        window.location.href = code;
    }}).off("click.qrCodeReader").on("click", function(){
      var qrcode = $("#single2").val().trim();
      if (qrcode) {
        window.location.href = qrcode;
      } else {



    <div align="center" class="container">
        <div align="center" class="col-xs-12">
            <div align="center" class="container" style="background-color:white; box-shadow:0px 2px #00000085;">
                <img style="margin-top:15px; margin-bottom:15px;" src="img/logo.png">
            <div align="center" class="col-xs-12" style="background-image: url(img/blakcstonemain.png); background-repeat:no-repeat; background-position:center; background-size: cover; margin-top:10px;">
                <!--Lavorazione : Scelta OP-->               
        <h1 style="margin-bottom: 0px;">Seleziona Ordine di Produzione</h1>
$conn = odbc_connect('', '', '');
    if(! $conn){
        print( "..." );
    //definisco gli ordini di produzione
    $sql="SELECT * 
            FROM dbo.OP_Ordini 
            LEFT JOIN dbo.MG_AnaART
            ON dbo.OP_Ordini.OPOR_MGAA_Id = dbo.MG_AnaArt.MGAA_Id ";
        if (!$rs)
        {exit("Errore nella tabella!");}
                echo"<option>| $ord_id | $ord_anno | $ord_ordine | $ord_lotto | $ord_desc | $mgaa_matr</option>";

                <!--Lavorazione : Scansione-->
                <div align="center" class="col-xs-12"> 
                    <h1 style="margin-bottom: 0px;">Scansione Materiale</h1>
                    <label for="single"></label>  
  <input id="single" type="text" size="50"> 
  <button type="button" class="qrcode-reader" id="openreader-single" data-qrr-target="#single" data-qrr-audio-feedback="false" data-qrr-qrcode-regexp="^https?:\/\/"><img style="width:20%;" src="img/qr1.png"></button>
                <!--Lavorazione : Matching-->    
                    <h1 style="margin-bottom: 0px;">Esamina</h1>
                        <img style="width:20%;" src="img/compara.png">
<input id="submit" type="submit" value="MANDALA!">
                    <!--<video id="preview" class="p-1 border" style="width:75%;border: solid #d34836;box-shadow: 5px 5px #000000a6;"></video>-->


Edited by requinix
please use the Code <> button when posting code
Link to post
Share on other sites

Start by editing your post and using the code icon (<>) and select PHP for your code. The formatter makes your code much easier to read. Second, tell us what error you are getting on what line or what you expect vs. what you are getting.

Link to post
Share on other sites

Even after your last post here I don't understand what problem you're having. You keep saying you're stuck and you need to match the QR scan with the drop-down. Is there an error message? What is the result of the QR scan? What is the value of the drop-down? Is there one or two drop-downs? What exactly isn't matching?

Explain what you want to happen and what is currently happening; copy and paste any error messages you're getting, and if you're not getting any error messages make sure you've got error reporting turned on and display errors enabled. And worse come to worst, check the server logs in case it's a server error and not a php error.

Link to post
Share on other sites

After dropdown selection and qr code scan -scan result is referred to production year-, press the submit button ("MANDALA") to match data.
I've tried to do this but maybe is too much for me.

There's no error message, nothing just happen.

Thanks in advance.


Link to post
Share on other sites

Thanks for the reply 😃
For the code, you mean like this?

echo "<form id='form_id' method='post' name='form'>";
$conn = odbc_connect('DB_FLUENTIS', 'Calistri', 'Calistri2020');
  echo"<option>| $ord_id | $ord_anno | $ord_ordine | $ord_lotto | $ord_desc | $mgaa_matr</option>";

echo'<button type="button" class="qrcode-reader" id="openreader-single" data-qrr-target="#single" data-qrr-audio-feedback="false" data-qrr-qrcode-regexp="^https?:\/\/"><img style="width:20%;" src="img/qr1.png"></button>'; 
echo"<input id=single>";
echo'<img src="img/compara.png" class="piccolo">';  
echo "<input id='submit' name='post' type='submit' value='submit'>"; 


Link to post
Share on other sites

Yes but again you should use the code icon. Now when you run the script you can follow the flow and determine what is going wrong, where.

Also make sure you have error reporting turned on. Put this at the top of your script:



Edited by gw1500se
Link to post
Share on other sites

So far you have not explained what pieces of data you want to match. We cannot help you until you make it clear what you are trying to accomplish. You are getting the same thing when you submit because you are processing the same page. Keep in mind that PHP is stateless. That means it does not know what happened the last time it was executed. I see nothing in your code that checks to see if the page is output the first time or output because of a submit. If you want something different to happen on a submit you need to know that button was clicked and do whatever for the submit. I am not sure what submit does when it is not part of a form or has no 'onclick' attribute.

Edited by gw1500se
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.