Using ASP and VBScript

Question:
I am developing an application using VBScript and ASP. I wrote this HTML code to be executed on a client’s machine:

      

The user will enter the name of customer in the first text box. When the user clicks the Submit button, I want to display the age of the customer in another text box on the same HTML form. The code required to search for the customer and obtaining the age is written in the “server.asp” file located on my server (I am using Personal Web Server). The code works, but I do not know how to get the data (age of the customer) from the server back to the current HTML form running on the client machine.

If there is no way to do this with ASP and VBScript, can you suggest something else?

Answer:

Once your visitor hits the Submit button, the form no longer exists on the client machine, so you can’t send the data back to the instance of the form on the screen.

However, you can send back the previous page, by filling in the text box with the proper value. Assuming that you have the answer for the age in your variable intAge, your server.asp page should “response.write” out the original HTML. Just replace the txtAge text box line with the line:

Another option is to send the HTML form back as it was, moving it above the form or somewhere else. You could send the answers like this:

Customer Name: <%= Request("txtName") %>

Age: <%= intAge %>

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

The Latest

microsoft careers

Top Careers at Microsoft

Microsoft has gained its position as one of the top companies in the world, and Microsoft careers are flourishing. This multinational company is efficiently developing popular software and computers with other consumer electronics. It is a dream come true for so many people to acquire a high paid, high-prestige job

your company's audio

4 Areas of Your Company Where Your Audio Really Matters

Your company probably relies on audio more than you realize. Whether you’re creating a spoken text message to a colleague or giving a speech, you want your audio to shine. Otherwise, you could cause avoidable friction points and potentially hurt your brand reputation. For example, let’s say you create a

chrome os developer mode

How to Turn on Chrome OS Developer Mode

Google’s Chrome OS is a popular operating system that is widely used on Chromebooks and other devices. While it is designed to be simple and user-friendly, there are times when users may want to access additional features and functionality. One way to do this is by turning on Chrome OS