#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2009
    Posts
    10
    Rep Power
    0

    Correctly using If Then Elseif ?


    Hi im rubbish at programming, but im trying....

    Im trying to get a page to display the details posted to a form. Part of it is working and part of it isnt for some reason.

    Ive declared a new value called "responsecode", responsecode = Request.Form("gtpay_tranx_status_code")
    If the value posted to the form field "gtpay_tranx_status_code" is either "00" (double zero) or "001" then it should
    run the first part of the code below:

    If responsecode = "00" Then '001 is for VISA 00 for interswitch and MIGS

    lblTranxDescription = "<font color=green><b>Transaction Completed Succesfully</b></font>"
    lbltranxID = tranxid
    lblDescription = "<font color=green><b>Payment Approved Succesfully</b></font>"
    lbltraAmt = tra_amt

    But for some reason although the responsecode is 00 it is not running that but jumping to the last part and shoing it as failed instead:

    Else
    lblTranxDescription = "<font color=red><b>Transaction Failed</b></font>"
    lblError = responsecode
    lbltranxID = tranxid
    lblDescription = responsemessage
    lbltraAmt = tra_amt

    Please can someone point out what ive done wrong?
    (Also is it possible to use CreateMHTMLBody "page.asp" to post itself to email or does it have to be another page?)
    Im running out of time to get this working, thank you for your help.
    Joe

    =========================================================================================

    Code:
       <form id="form1" runat="server">
        <div>
        <%
    
                    If Request.Form >"" Then
     
                        Dim responsecode 
    					responsecode = Request.Form("gtpay_tranx_status_code")
                        Dim responsemessage
    					responsemessage = Request.Form("gtpay_tranx_status_msg")
                        
                        Dim tra_amt
    					tra_amt = Request.Form("gtpay_tranx_amt")
                        Dim tranxid 
    					tranxid = Request.Form("gtpay_tranx_id")
                        Dim cust_id
    					cust_id = Request.Form("gtpay_cust_id")
                     	Dim tranx_memo
    					tranx_memo = Request.Form("gtpay_tranx_memo")
    					Dim echo_data
    					echo_data = Request.Form("gtpay_echo_data")
    					
    				  Dim lblTranxDescription
    				  Dim lblDescription
    				  Dim lbltraAmt
    				  
                        If responsecode = "00"  Then   '001 is for VISA  00 for interswitch and MIGS
    
                            lblTranxDescription = "<font color=green><b>Transaction Completed Succesfully</b></font>"
                            lbltranxID = tranxid
                            lblDescription = "<font color=green><b>Payment Approved Succesfully</b></font>"
                            lbltraAmt = tra_amt
    						
    					Elseif responsecode = "001"  Then
    					
    					    lblTranxDescription = "<font color=green><b>Transaction Completed Succesfully</b></font>"
                            lbltranxID = tranxid
                            lblDescription = "<font color=green><b>Payment Approved Succesfully</b></font>"
                            lbltraAmt = tra_amt
    						
                        Else
                            lblTranxDescription = "<font color=red><b>Transaction Failed</b></font>"
    						lblError = responsecode
                            lbltranxID = tranxid
                            lblDescription = responsemessage
                            lbltraAmt = tra_amt
                        End If
    
                    End If
    %>
    
            <table class="htmlForm2">
                <tr>
                    <td>
                       <h3>Your Transaction has been completed please find the status of the transaction below:</h3>
                       </td>
                </tr>
                <tr>
                    <td><% response.write lblError %>
                        </td>
                </tr>
    			 <tr>
                    <td>
                       Order Id: <% response.write cust_id %>
                    </td>
                </tr>
                <tr>
                    <td>
                       Transaction Description: <% response.write lblTranxDescription %>
                    </td>
                </tr>
                <tr>
                    <td>
                        Transaction Reference: <% Response.write lbltranxID %>
                        
                    </td>
                </tr>
                <tr>
                    <td>
                        Response Description: <% response.write lblDescription %>
                    </td>
                </tr>
                <tr>
                    <td>
                        Transaction Amount: N<% response.write lbltraAmt %>
                    </td>
                </tr>
                <tr>
                    <td>&nbsp;
                        </td>
                </tr>
               
            </table>
        
        </div>
        </form>
  2. #2
  3. No Profile Picture
    Grumpier old Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2003
    Posts
    14,424
    Rep Power
    4539
    Probably responsecode doesn't contain the string you expect. You can add response.write responsecode lines to debug and see the current value.
    ======
    Doug G
    ======
    The man who doesn't read good books has no advantage over the man who can't read them.
    --Mark Twain
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2009
    Posts
    10
    Rep Power
    0

    building a url string


    Originally Posted by Doug G
    Probably responsecode doesn't contain the string you expect. You can add response.write responsecode lines to debug and see the current value.
    How do you include a response.write value inside the
    <%

    MailBody = "<% response.write responsecode %> "

    %>

    That wont work will it?

    How do I put stored values in there?
  6. #4
  7. No Profile Picture
    Grumpier old Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2003
    Posts
    14,424
    Rep Power
    4539
    Code:
    <%
    response.write <somevariable>
    response.end
    %>
    Response.end will stop further output to the web browser so your debug variable doesn't get overwritten on the page.
    ======
    Doug G
    ======
    The man who doesn't read good books has no advantage over the man who can't read them.
    --Mark Twain

IMN logo majestic logo threadwatch logo seochat tools logo