Solved

Using VB5-Cgi Objects to pass variables to webpage

Posted on 1998-12-29
4
176 Views
Last Modified: 2013-12-25
I'm using VB5-CGI Objects to write cgi and Access 97 to
   keep my data.  I have a webpage which displays the result after querying the
   database.  The result will have a hyperlink to another webpage.  I want to pass the
   result to the final webpage.  So, I use HTML.bodyHTML to write like this...

   <a href="http://default/sample.htm?Data1=" & rs.Fields("Data1") & "&Data2=" &
   rs.Fields("Data2") & "&Data3=" & rs.Fields("Data3")  target="blank"> "   

   But the final webpage can only get the value of Data1, it can't get the others.  If my
   Data1 has the value of "My data", the final webpage gets only 'My', but no 'data'.  

   So, how should I pass variables using VB5-CGI Objects?  Please help...

   Thanks in advance...
0
Comment
Question by:hor
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 

Author Comment

by:hor
ID: 1830315
Adjusted points to 150
0
 
LVL 11

Expert Comment

by:mouatts
ID: 1830316
The problem you are suffering is that you are putting invalid characters into the url. In your example the space between 'My' and 'data' needs to be converted to a '+'.

Ths is known as URL Encoding which means that any character after the question mark that is not valid within a URL is encoded as a + if it is a space or its ASCII value in Hex preceded by a %.

VB is not the easiest language to do this in but fortunately the server object has a URLEncode method that will do the job for us so your code should be changed to the following.

<a href="http://default/sample.htm?Data1=" & Server.URLEncode(rs.Fields("Data1")) & "&Data2=" & 
   Server.URLEncode(rs.Fields("Data2")) & "&Data3=" & Server.URLEncode(rs.Fields("Data3"))  target="blank"> "   

Hope this helps

Steve
0
 

Author Comment

by:hor
ID: 1830317
What references or components should I use so that the Server.URLEncode() will be accepted by VB5 when I press F5?
0
 
LVL 11

Accepted Solution

by:
mouatts earned 150 total points
ID: 1830318
Sorry I misunderstood that you were writing vbScript thus I don't really know what you are talking about when you say 'press F5'

Nevertheless that basic problem is still the same. Convert the spaces to + and the url will be fine so long as the remainder of the url doesn't contain punctuation characters.

Steve
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

737 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