Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Open ASP page with QR code and query string

Community Beginner ,
Feb 24, 2012 Feb 24, 2012

I can create QR code with a query string on it like http://ereply.us/bc/l.asp?id=mm008 which takes me to a page with a "Submit" button.  The submit button, in turn, takes me to a page (Index.asp) with variable content.  I'm using session variables and SQL server.  What I would like to do is have the QR code scan directly to the Index.asp page and eliminate the intermediate page with the submit button.  I'm stumped.  Any ideas would be appreciated.  Code is below:

"l.asp":

<!-- #include file="database_connection.asp" -->

<%

if not isempty(request("submit")) then

  sql="select password, fname, lname, name, coupon, email, ID, barcode, url from C39 where password = '"&trim(request.Form("password"))&"'"

 

if rs.state=1 then rs.close

   rs.open sql,conn,3,2

  

   if rs.recordcount<>0 then

           session("password") = rs("password")

        session("fname") = rs("fname")

        session("lname") = rs("lname")

        session("name") = rs("name")

        session("email") = rs("email")

        session("ID") = rs("ID")

        session("barcode") = rs("barcode")

        session("coupon") = rs("coupon")

        session("url") = rs("url")

       

    if rs("password")<>"" then response.Redirect("index.asp")

    else

      var_comment="We're sorry, your password does not match.  Please try again.."

    end if

end if

%>

<html>

<head>

body

        

<form name="login_form" formid="login_form" action="" method="POST">

<% if var_comment<>"" then %>

      <% else %>

           

        

        <input name="password" type="hidden" class="style4" value=<% response.write(request.querystring("id") )  %>>

 

  <p Please click the "Submit" button to retrieve your coupon.</p>

 

    <input name="Submit" type="submit"  id="Submit" value="Submit">

    </span><br>

   

    <input type="hidden" name="submit" value="submit; Log In    " >

   

   

    <% end if%>

  </p>

</form>

</body>

<script>document.login_form.submit();</script>

</HTML>

And the "Index.asp" contains the following:

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<!-- #include file="database_connection.asp" -->

<head>

<title>Franklin Grande Riviera</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>

<link href="CSS/Level1_Arial.css" rel="stylesheet" type="text/css"/>

<form action="aspform.asp" method="post">

  <p><img src="http://ereply.us/bc/fgr.gif" width="250" height="109" alt="logo" /></p>

  <p>

    <input name="fname" type="hidden" value='<%=session("fname")%>' />

    <input name="lname" type="hidden" value='<%=session("lname")%>' />

    <input name="address" type="hidden" value='<%=session("email")%>' />

    <input name="id" type="hidden" value='<%=session("id")%>' />

    <input name="barcode" type="hidden" value='<%=session("barcode")%>' />

    <input name="coupon" type="hidden" value='<%=session("coupon")%>' />

    <input name="password" type="hidden" value='<%=session("password")%>' />

    <input name="url" type="hidden" value='<%=session("url")%>' />

  </p>

 

  <%response.write(session("fname"))%> <%response.write(session("lname"))%>

     

  <%response.write(session("coupon"))%>

</form>

<h1 class="style1">

  <script language="JavaScript" src="code39.js"></script></h1>

<h1 class="style1"><script language="JavaScript">

 

      document.open();

document.write

Code39("","",200,12,"<% response.write(session("barcode"))%>",5);

document.close();

    </script></h1>

</body>

</html>

TOPICS
Server side applications
6.6K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 24, 2012 Feb 24, 2012

>I can create QR code with a query string on it like

>http://ereply.us/bc/l.asp?id=mm008 which takes me to a page with a "Submit" button.

That's not a QR code, is it?

Sorry, your question is a bit fuzzy. Please explain the exact workflow you would like. You say you want to scan directly to an index page. So are you asking how to use a scanner to read a barcode into a form field?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 27, 2012 Feb 27, 2012

Sorry if I was fuzzy.  First of all the code from the page that the QR code scans to somehpw was deleted from the post.  Here is the code for l.asp.  So if I create a QR with query string like http://ereply.us/bc/l.asp?id=mm008 it takes me to this page and I can click the submit button and go to index.asp.  I am trying to eliminate this itermediary step.

<!-- #include file="database_connection.asp" -->
<%
if not isempty(request("submit")) then
  sql="select password, fname, lname, name, coupon, email, ID, barcode, url from C39 where password = '"&trim(request.Form("password"))&"'"
 
if rs.state=1 then rs.close
   rs.open sql,conn,3,2
  
   if rs.recordcount<>0 then
     session("password") = rs("password")
  session("fname") = rs("fname")
  session("lname") = rs("lname")
  session("name") = rs("name")
  session("email") = rs("email")
  session("ID") = rs("ID")
  session("barcode") = rs("barcode")
  session("coupon") = rs("coupon")
  session("url") = rs("url")
 
if rs("password")<>"" then response.Redirect("index.asp")
else
   var_comment="We're sorry, your password does not match.  Please try again.."
end if
end if

%>

<form name="login_form" formid="login_form" action="" method="POST">

<% if var_comment<>"" then %>
   <% else %>
 
    
          <div align="center">
            <p><img src="http://ereply.us/bc/fgr.gif" alt="logo" width="250" height="109"></p>
            <p class="style4"> </p>
          </div>
      <div align="justify">
        <input name="password" type="hidden" class="style4" value=<% response.write(request.querystring("id") )  %>>
  </div>
  <p>
            <label></label>
  </p>
  <p class="style2 style4">Please click the "Submit" button to retrieve your coupon.</p>
  <p class="style2 style4"> </p>
  <p><span class="style2 style6">
    <input name="Submit" type="submit" class="style6" id="Submit" value="Submit">
    </span><br>
   
    <input type="hidden" name="submit" value="submit; Log In    "

    <% end if%>
  </p>
</form>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 27, 2012 Feb 27, 2012

The name of the value in your querystring is 'id', but your form is submitting a name of 'password' which is then used in the index. So you just need to change the name in the querystring:

http://ereply.us/bc/index.asp?password=mm008

By the way, I still don't see a QR code - just a standard barcode.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 27, 2012 Feb 27, 2012

The URL/query string should be

http://ereply.us/bc/index.asp?id=mm008

That eventually produces a page with a regular bar code that is redeemed at a POS terminal.

The QR code is created from the above URL/query string:

http://qrcode.kaywa.com/img.php?s=8&d=http%3A%2F%2Fereply.us%2Fbc%2Fl.asp%3Fid%3Dmm008

I appreciate your help with this!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 27, 2012 Feb 27, 2012

>The URL/query string should be

OK, then you just need to modify index.asp to use id, rather than password for the name of the request variable used in the SQL where clause.  You are also using Request.Form to get the value. While this may work for a querystring, you'd be better off switching to Request.Querystring. If you still want

to be able to have that intermediate form function, then you'll need to change the field name from password to id, and change the method from post to get.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 28, 2012 Feb 28, 2012

On the initial form "l.asp" I am using Request.Querystring.  Everything, as is, works properly.  All I am trying to do is eliminate the interim step of going to l.asp and have the QR code, when scanned, go directly to index.asp.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 28, 2012 Feb 28, 2012

Yes. I have given you the solution that works as you requested. If this is not what you want, tell us what is wrong with the proposed solution.

>when scanned,

When scanned by what? And there is still nothing in any of the pages you have shown us that produced a QR code, so check the links you have posted.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 28, 2012 Feb 28, 2012

This QR, on a printed document and scanned with a mobile devices, resolves to http://ereply.us/bc/l.asp?id=mm008 which created a page with a submit button that takes the user to the page (index.asp) which displays user name, dollar amount and a 1D regular bar code to be used at a POS terminal.  I would like the code to open index.asp without the intermediate step.

img.php.png

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 28, 2012 Feb 28, 2012

Ah, now I got you. Can you post the code from the I.asp page, and I'll show you what to change.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 28, 2012 Feb 28, 2012

Assuming that I.asp is the code you posted a few posts back, try changing this:

if not isempty(request("submit")) then

  sql="select password, fname, lname, name, coupon, email, ID, barcode, url from C39 where password = '"&trim(request.Form("password"))&"'"

to this:

if not isempty(request.querystring("id")) then

  sql="select password, fname, lname, name, coupon, email, ID, barcode, url from C39 where password = '"&trim(request.Querystring("id"))&"'"

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 01, 2012 Mar 01, 2012

@bregent:

Magnifique!  It worked like a charm.  I was just about to start trying some javascript onload event handler to the page.   Thank you so much for your assistance (and persistence) with this.

Check it out:  http://ereply.us/bc/l.asp?id=mm008

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 02, 2012 Mar 02, 2012
LATEST

Great. Glad it worked out.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines