Solved

Using VB5-Cgi Objects to pass variables to webpage

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

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

In this tutorial I will focus on how to use WhizBase as a tool for sending ICQ messages to ICQ. Here I will use a new technology in WhizBase, published in WhizBase 5.1 version. In this tutorial I will use 3 files, pager.wbsp for the processing, e…
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…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
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…

863 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

21 Experts available now in Live!

Get 1:1 Help Now