Solved

check for QS or posted value and place value in variable

Posted on 2003-10-31
3
201 Views
Last Modified: 2010-04-17
Hi

Can someone help?
I have a validation(hidden) page which retrieves data and submits it and then response.redirect's to another page called process.asp. It passes the id as a querystring. (prefereably I'd like it to be passed by post method as it's more secure but guess not possible?)

The process.asp page now needs to check for this querystring and *also* posted values coming in from other  pages. So there are values coming in from 2 types of methods but only one at a time. So either req.form will be empty or req.qs will be empty.
I need to check:
- are both empty? then print this page
- if the qs isn't empty then put it in strid else if request.form isn't empty then put that value in strid.
How do I make sure that strid is not empty?

I am posting the relevant code. It may be easier for you to see as I'm even having difficulty explaining it! You will see 3 links that use the post method. On the pages they post to, there is a back button which posts the value back to the process page. That is why I need to check for values posted. I am trying to avoid using QS's.

Thanks. Appreciate it.
lee

<%
Dim strid, stridpassed
Response.Expires=0
%>
<% 'if value passed by qs or form then means that user has completed step 1 so mark step 1 as completed.
'if no value passed then they have not yet completed step 1.
if Request.form = "" or Request.querystring = "" then
'below - this table appears if qs or posted value empty ie user not completed step 1.
%>


<%else if Request.Form <> "" then
strid = Request.form("id")
else if Request.QueryString <> "" then
strid=Request.QueryString("id")

'retrieve NINumber was passed from editvalidate.asp or pension_form.asp

stridpassed = strid

%>

<table class="bylinefont" width="100%" bgcolor="white" border="0" cellpadding="0" cellspacing="0" align="left">
      <tr>
            <td width="3%" class="bg1" rowspan="2"></td>
            <td width="72%" bgcolor="#666633"></td>
            <td width="170" bgcolor="#cccc99"><img src="images/bg_taupe.gif" alt="EF" height="6" /></td>
            <td width="3%" rowspan="2" class="bg2"></td>
            <td width="1%" rowspan="2"></td>
      </tr>
      <tr>            
            <td height="70" colspan="2" width="780" valign="bottom" align="left"><img src="images/logo_new_X.gif" alt="EF" width="223" height="36" align="left" /><center><img src="images/by_line_X.gif" alt="EF - innovative financial solutions for the non-domiciled traveller living in the UK" / WIDTH="307" HEIGHT="35"></center></td>
      </tr>
      <tr>
            <td width="3%" class="bg3"></td>
            <td width="72%" class="bg3"></td>
            <td width="170" class="bg3"></td>
            <td width="3%" class="bg3"></td>
            <td width="1%" class="bg3"></td>
      </tr>
      <tr>
            <td width="3%" height="135" class="bg1"></td>
            <td colspan="2" height="135">

                  <table width="98%" align="center" border="0" cellpadding="0" cellspacing="0">
                  <tr><td class="bg5" height="129" valign="middle"></td>
                  </tr>
                  </table>
            </td>
            <td width="3%" height="135" class="bg2"> &nbsp; </td>
            <td width="1%"></td>
      </tr>
      <tr>
            <td width="3%" class="bg3"></td>
            <td width="72%" class="bg3"></td>
            <td width="170" class="bg3" align="left"></td>
            <td width="3%" class="bg3"></td>
            <td width="1%" class="bg3"></td>
      </tr>
      <tr>
            <td width="3%" height="400" class="bg1"></td>
            <td width="72%" valign="top"><br />
            
                        <table width="100%" align="center" border="0" cellspacing="8" cellpadding="8">
                        <tr>
                        <td>
                                    <!-- **************** CONTENT TABLE HERE ****************** -->
                        <p class="mainheading">Process in order to contract out of the Second State Pension</p>
                        <p>
                        In order to contract out of the State Second Pension Scheme(&quot;S2P&quot;), there are 4 steps that you need to follow in the order they appear. We will guide you through this process. Please read through all the steps carefully before proceeding.<br /> &nbsp; <br />
                        <font color="red">You have completed step 1.</font><br /><b>Step One.</b> <a href="pension_form.asp"><b>Complete</b></a> the online <b>Pension Information form</b>.
                        <br /> &nbsp; <br />
                        
                        <b>Step Two. Review and print </b><br />
                        Both the Member Application Letter and the National Insurance Contributions form
                         have been pre-populated with the data
                        supplied within the above-mentioned Pension Information
                        Form. Please check that all details provided are correct.
                        If any details are incorrect, please proceed to step 3. If
                        you agree with the all the details, please print each of the pages within this step.
                              
                        <form action="printinstructions.asp" method="post" name="feedbackform1" id="feedbackform1">            
                        <input type="hidden" name="id" value="<%=stridpassed%>" />
                      i. <a href="#" onclick="document.feedbackform1.submit()">Read and print</a> the instructions page.
                      </form>
                    
                      <form action="printmemberletter.asp" method="post" name="feedbackform2" id="feedbackform2">      
                      <input type="hidden" name="id" value="<%=stridpassed%>" />
                      ii. <a href="#" onclick="document.feedbackform2.submit()">Review and print</a> the Member Application Letter
                      </form>
                      
                      <form action="printinlandrevenue.asp" method="post" name="feedbackform3" id="feedbackform3">      
                      <input type="hidden" name="id" value="<%=stridpassed%>" />
                      iii. <a href="#" onclick="document.feedbackform3.submit()">Review and print</a> the National Insurance Contributions form (CA8057)
                      </form>
                                        
                              
                        <b>Step Three.</b> <a href="login.asp"><b>Edit</b></a> - If any of the details within the Member
                        Application Letter and National Insurance Contributions form are incorrect, you will need to log in in order to  
                        edit the Pension Information form.
                        You will then need to complete step 2 again.
                        <br /> &nbsp; <br />
                        
                        <b>Step 4.</b> Once you have printed both forms, please:<br />
                        ii. Sign and date your signature at the bottom of the Member
                        Application Letter on page 2; and<br />
                        iii. Sign and date your signature in section 2 on National Insurance Contributions form (CA8057)on page 3
                        <br /> &nbsp; <br />
                        
                        <b>Step 5.</b> Send the Member Application Letter and National Insurance Contributions form (CA8057 - pages 1-4) via post to:<b>*</b><br /> &nbsp; <br />
                        
                              </p>
                        </td>
                        </tr>
                        </table>
                        
                        
                        <!-- check CHECKBOX checked This MUST appear after form tag closed -->
                                                <!-- **************** END CONTENT HERE ****************** -->
            
                              
            </td>
            <td width="170" valign="top" align="left" class="bg4">
            <br /> &nbsp; <img src="images/big_01.gif" width="75" alt="EF" height="60" /><br /> &nbsp; <br />
                        <table width="90%" bgcolor="white" border="0" cellpadding="0" cellspacing="0" align="right">
                        <tr>
                              <td>
                              <a href="index.htm" onmouseover="window.status='{ EF ~ Home }'; return true;" onmouseout="window.status='{ EF }'"><img src="images/link_home.gif" border="0" alt="home" width="70" height="12" /></a>
                              <br /><a href="pensions.htm" onmouseover="window.status='{ EF ~ Pensions }'; return true;" onmouseout="window.status='{ E F }'"><img src="images/link_pensions.gif" border="0" alt="pensions" width="100" height="17" /></a>
                              <br /><a href="faq.htm" onmouseover="window.status='{ EF ~ FAQ }'; return true;" onmouseout="window.status='{ EF }'"><img src="images/link_faq.gif" border="0" alt="faq" width="55" height="17" /></a>
                              <br /><a href="login.asp" onmouseover="window.status='{ EF ~ Login }'; return true;" onmouseout="window.status='{ E F }'"><img src="images/link_login.gif" border="0" alt="login" width="71" height="17" /></a>
                              <br /><a href="about.htm" onmouseover="window.status='{ EF ~ About E }'; return true;" onmouseout="window.status='{ E F }'"><img src="images/link_about.gif" border="0" alt="about" width="128" height="17" /></a>
                              <br /><a href="contact.htm" onmouseover="window.status='{ EF ~ Contact }'; return true;" onmouseout="window.status='{ E F }'"><img src="images/link_contact.gif" border="0" alt="contact" width="97" height="17" /></a>
                              </td>
                        </tr>
                        </table>
            </td>
            <td width="3%" height="30" class="bg2"></td>
            <td width="1%"></td>
      </tr>
      <tr>
            <td width="3%" class="bg3"></td>
            <td width="72%" class="bg3"></td>
            <td width="170" class="bg3"></td>
            <td width="3%" class="bg3"></td>
            <td width="1%" class="bg3"></td>
      </tr>
      <tr>
            <td width="3%" height="25" class="bg1"><img src="images/spacer_dot.gif" alt="E F" width="25" height="3" /></td>
            <td width="72%"> &nbsp; </td>
            <td width="170"> &nbsp; </td>
            <td width="3%" height="25" class="bg2"></td>
            <td width="1%"></td>
      </tr>
      <tr>
            <td colspan="5" class="bg3"></td>
      </tr>
</table>
<%end if%>
<%end if%>
<%end if%>
</body>
</html>






0
Comment
Question by:leeolive
  • 2
3 Comments
 
LVL 7

Accepted Solution

by:
Brad Dobyns, CSM earned 45 total points
ID: 9694981
Well, one problem I see here is that you cannot say:

If Request.Form = "" Or Request.QueryString = "" Then

You have to say it like this (or something like this):

If Request.Form("<field name>") = "" Or Request.QueryString("id") = "" Then

If you are using the Request.Form or .QueryString methods, you HAVE to be calling the value of some field or string name.

Brad
0
 
LVL 7

Expert Comment

by:Brad Dobyns, CSM
ID: 9695244
Thanks for the points and the grade! :o)

Brad
0
 

Author Comment

by:leeolive
ID: 9695297
pleasure. thanks for the help!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
This article will show, step by step, how to integrate R code into a R Sweave document
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now