Hello experts.
I wish to post a string and display the output in the same page.
The Scenario:
Table name: importer
Field name: imp_code, imp_sname, imp_address, imp_tel
I have a page which consists of
(i) a form
(ii) output fields
When the user key-in the imp_code through the keyboard the system should check whether the code exist in the database.
If the code does not exist, it should display a pop up window "Importer code does not exist!"
Else if the code exist in the database the system should populate the text fields keeping the form field imp_code still displayed with what the user has typed.
I have given it a try, but it does not work !
Here is my code:
Please help ........
I wish to post a string and display the output in the same page.
The Scenario:
Table name: importer
Field name: imp_code, imp_sname, imp_address, imp_tel
I have a page which consists of
(i) a form
(ii) output fields
When the user key-in the imp_code through the keyboard the system should check whether the code exist in the database.
If the code does not exist, it should display a pop up window "Importer code does not exist!"
Else if the code exist in the database the system should populate the text fields keeping the form field imp_code still displayed with what the user has typed.
I have given it a try, but it does not work !
Here is my code:
Code:
<% @language="VBScript" %>
<% option explicit %>
<%
if request.form("action") <> "query_importer" then
%>
<form method="post">
<input type="hidden" name="action" value="query_importer">
Importer Code: <input type="text" name="impcode">
<br/>
<input type="submit" name="submit" value="submit">
</form>
<%
else
dim strImpcode
strImpcode = request.form("impcode")
dim adocon, adorst, strSQL
set adocon = server.createobject("ADODB.connection")
adocon.open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source= "&server.mapPath("sp.mdb")
set adorst= server.createobject("ADODB.Recordset")
strSQL="SELECT * FROM importer WHERE imp_code='"&strImpcode&"'"
adorst.open strSQL, adocon
%>
<html>
<body>
<%
do while not adorst.eof
response.write adorst("imp_sname")
response.write("<br/>")
response.write adorst("imp_oname")
response.write("<br/>")
response.write adorst("imp_address")
response.write("<br/>")
response.write adorst("imp_tel")
adorst.movenext
loop
%>
<%end if%>
</body>
</html>
Comment