Solved

Using VB5-Cgi Objects to pass variables to webpage

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Ever wondered how to display how many visitors you have online. In this tutorial I will show you an easy but effective way to display the number of online visitors in WhizBase. In this article I assume you have read my previous articles and know …
It is becoming increasingly popular to have a front-page slider on a web site. Nearly every TV website,  magazine or online news has one on their site, and even some e-commerce sites have one. Today you can use sliders with Joomla, WordPress or …
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…
The viewer will learn how to dynamically set the form action using jQuery.

708 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

11 Experts available now in Live!

Get 1:1 Help Now