Solved

Using VB5-Cgi Objects to pass variables to webpage

Posted on 1998-12-29
4
177 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

Business Impact of IT Communications

What are the business impacts of how well businesses communicate during an IT incident? Targeting, speed, and transparency all matter. Find out more in this infographic.

Question has a verified solution.

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

I hope you'll find this tutorial useful and interesting. So let's try to extend Tcl with a new package.  For anyone more deeply interested please check out the book "Practical Programming in Tcl and Tk". It's really one of the best written books abo…
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.
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

705 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