Jump to content

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%;">
<head>
<meta charset=utf-8>
<meta http-equiv=X-UA-Compatible content="IE=edge">
<meta name=viewport content="width=device-width, initial-scale=1">
  <title></title>
  <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> 
<script>
  
  $(function(){

    // 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
    $(".qrcode-reader").qrCodeReader();

    // 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 {
        $.qrCodeReader.instance.open.call(this);
      }
    });


  });

</script>    
</head>

<body>
    <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>    
            <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;">
                <br>
                
                <!--Lavorazione : Scelta OP-->               
        <h1 style="margin-bottom: 0px;">Seleziona Ordine di Produzione</h1>
                <?php
$conn = odbc_connect('', '', '');
    if(! $conn){
        print( "..." );
        exit;
    }
    //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 ";
    $rs=odbc_exec($conn,$sql);
        if (!$rs)
        {exit("Errore nella tabella!");}
    echo"<center>";
        echo"<br>";
        echo"<select>";
        echo"<option>--ORDINI--</option>";
            while(odbc_fetch_row($rs))
            {
    $ord_id=odbc_result($rs,"OPOR_Id");            
    $ord_anno=odbc_result($rs,"OPOR_Anno");            
    $ord_ordine=odbc_result($rs,"OPOR_Ordine");
    $ord_lotto=odbc_result($rs,"OPOR_Lotto");
    $ord_desc=odbc_result($rs,"OPOR_Descr");  
    $mgaa_matr=odbc_result($rs,"MGAA_Matricola");                
                echo"<option>| $ord_id | $ord_anno | $ord_ordine | $ord_lotto | $ord_desc | $mgaa_matr</option>";
            }
    echo"</select>";
    echo"<br>";
    echo"<br>";

?>
                <!--Lavorazione : Scansione-->
                <div align="center" class="col-xs-12"> 
                    <h1 style="margin-bottom: 0px;">Scansione Materiale</h1>
                    <br>
                    <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>-->
                </div>
            </div>    
        </div>
    </div>
</body>
</html>

 

Edited by requinix
please use the Code <> button when posting code

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.

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.

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.

screen.PNG

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

<?php
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"<option>$ord_id</option>";
            }          
    echo"</select>";        
           
    echo"<br>";

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"<br>";                
echo'<img src="img/compara.png" class="piccolo">';  
echo"<br>";
echo "<input id='submit' name='post' type='submit' value='submit'>"; 

?>

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:

error_reporting(E_ALL);

 

Edited by gw1500se

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
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

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

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