Bramhowl Posted September 1, 2020 Share Posted September 1, 2020 (edited) 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 September 1, 2020 by requinix please use the Code <> button when posting code Quote Link to comment https://forums.phpfreaks.com/topic/311413-php-data-matching-dropdown-with-qr-code-scan/ Share on other sites More sharing options...
gw1500se Posted September 1, 2020 Share Posted September 1, 2020 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. Quote Link to comment https://forums.phpfreaks.com/topic/311413-php-data-matching-dropdown-with-qr-code-scan/#findComment-1581075 Share on other sites More sharing options...
maxxd Posted September 2, 2020 Share Posted September 2, 2020 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. Quote Link to comment https://forums.phpfreaks.com/topic/311413-php-data-matching-dropdown-with-qr-code-scan/#findComment-1581084 Share on other sites More sharing options...
Bramhowl Posted September 2, 2020 Author Share Posted September 2, 2020 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. Quote Link to comment https://forums.phpfreaks.com/topic/311413-php-data-matching-dropdown-with-qr-code-scan/#findComment-1581085 Share on other sites More sharing options...
gw1500se Posted September 2, 2020 Share Posted September 2, 2020 'echo' your data throughout the script so you can see what the variables are as the logic progresses. Quote Link to comment https://forums.phpfreaks.com/topic/311413-php-data-matching-dropdown-with-qr-code-scan/#findComment-1581087 Share on other sites More sharing options...
Bramhowl Posted September 2, 2020 Author Share Posted September 2, 2020 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'>"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/311413-php-data-matching-dropdown-with-qr-code-scan/#findComment-1581089 Share on other sites More sharing options...
gw1500se Posted September 2, 2020 Share Posted September 2, 2020 (edited) 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 September 2, 2020 by gw1500se Quote Link to comment https://forums.phpfreaks.com/topic/311413-php-data-matching-dropdown-with-qr-code-scan/#findComment-1581091 Share on other sites More sharing options...
Bramhowl Posted September 3, 2020 Author Share Posted September 3, 2020 Ow, ok, thanks I got it. There's no error, the code just "refresh" the page when I press the submit button. I have no clue for data matching, I guess I'm so far from my goal... Quote Link to comment https://forums.phpfreaks.com/topic/311413-php-data-matching-dropdown-with-qr-code-scan/#findComment-1581103 Share on other sites More sharing options...
gw1500se Posted September 3, 2020 Share Posted September 3, 2020 (edited) 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 September 3, 2020 by gw1500se Quote Link to comment https://forums.phpfreaks.com/topic/311413-php-data-matching-dropdown-with-qr-code-scan/#findComment-1581111 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.