Hi,
I was wondering if this was possible.
I have 2 asp pages, page1.asp has 1 forms for adding records to the database, I have a hidden field in the form that passes a value to page2.asp this variable kicks off a sub that adds the record to the database. once the record has been added you can view it in the listing below in the form.
the record listings below have a delete and update hyperlink. I would like the hyperlink to call a sub on page2.asp when clicked.
I have posted the code below to show you what I'm trying to achieve..
Many Thanks
<-------------Code--------------------------------------->
<!--#include virtual="/includes/connection.asp" -->
<html>
<head>
<title>ADD NEW EXCHANGE RATE TO DATABASE</title>
<script language="vbscript">
Function ValidateForm_onsubmit()
If frmexchrate.strcurrency.value = "" Then
MsgBox "Please enter a Currency Value!"
ValidateForm_onsubmit = False
ElseIf IsNumeric(frmexchrate.strcurrency.value) Then
MsgBox "Currency field can only be text!"
ValidateForm_onsubmit = False
ElseIf frmexchrate.strvalue.value = "" Then
MsgBox "Please enter a Exchange Rate!"
ValidateForm_onsubmit = False
ElseIf not IsNumeric (frmexchrate.strvalue.value) Then
MsgBox "Currency field can only be a number!"
ValidateForm_onsubmit = False
End If
End Function
</script>
</head>
<body>
<div align="left">
<table class="table">
<form action="expcmd.asp" method="post" id="frmexchrate" name="ValidateForm">
<tr><td></td>
<td><Input type="hidden" name="addrec" value="addrec">
</td></td>
<tr>
<tr><td>Currency Type:</td>
<td><Input type="text" name="strcurrency" size="10">
</td></td>
<tr>
<tr><td>Value to GBP:</td>
<td><Input type="text" name="strvalue" size="10">
</td></td>
<tr>
<tr>
<td></td><td><input type="submit" name="cmdValidate" value="Add"><space><space>
<input type="button" value="Cancel" onclick=location.href="/exrate"></td>
<br>
<br>
</tr>
<tr>
</form>
</table>
exrate.asp:
<html>
<head>
<title>Exchange Rate List</title></head>
<body bgcolor="white" text="black">
<%
Dim rsExRate
Dim strSQL
Dim lngRecordNo
lngRecordNo = CLng(Request.QueryString("ID"))
Set rsExRate = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT tblexchange.* FROM tblexchange;"
rsExRate.Open strSQL, conn
Response.Write ("<table width='400px' border='0'>")
Response.Write ("<tr>")
Response.Write ("<th align='Left'>CURRENCY</th>")
Response.Write ("<th align='Left'>EXCH RATE</th>")
Response.Write ("<th align='Left'>DEL</th>")
Response.Write ("</tr>")
Do While Not rsExRate.EOF
Response.Write ("<tr>")
Response.Write ("<td align='Left'>")
Response.Write ("<a href=""expcmd.asp?ID=" & rsExRate("ID") & """>")
Response.Write (rsExRate("strcurrency"))
Response.Write ("</td>")
Response.Write ("<td align='Left'> ")
Response.Write (rsExRate("strvalue"))
Response.Write ("</td>")
Response.Write ("<td align='left'>")
Response.Write ("<a href=""expcmd.asp?ID=" & rsExRate("ID") & """>")
Response.Write ("Delete")
Response.Write ("</td>")
Response.Write ("<tr>")
rsExRate.MoveNext
Loop
Response.Write ("</table>")
rsExRate.Close
Set rsExRate = Nothing
Set adoCon = Nothing
Set conn = Nothing
%>
" New To Programming - Learning Fast
I was wondering if this was possible.
I have 2 asp pages, page1.asp has 1 forms for adding records to the database, I have a hidden field in the form that passes a value to page2.asp this variable kicks off a sub that adds the record to the database. once the record has been added you can view it in the listing below in the form.
the record listings below have a delete and update hyperlink. I would like the hyperlink to call a sub on page2.asp when clicked.
I have posted the code below to show you what I'm trying to achieve..
Many Thanks
<-------------Code--------------------------------------->
<!--#include virtual="/includes/connection.asp" -->
<html>
<head>
<title>ADD NEW EXCHANGE RATE TO DATABASE</title>
<script language="vbscript">
Function ValidateForm_onsubmit()
If frmexchrate.strcurrency.value = "" Then
MsgBox "Please enter a Currency Value!"
ValidateForm_onsubmit = False
ElseIf IsNumeric(frmexchrate.strcurrency.value) Then
MsgBox "Currency field can only be text!"
ValidateForm_onsubmit = False
ElseIf frmexchrate.strvalue.value = "" Then
MsgBox "Please enter a Exchange Rate!"
ValidateForm_onsubmit = False
ElseIf not IsNumeric (frmexchrate.strvalue.value) Then
MsgBox "Currency field can only be a number!"
ValidateForm_onsubmit = False
End If
End Function
</script>
</head>
<body>
<div align="left">
<table class="table">
<form action="expcmd.asp" method="post" id="frmexchrate" name="ValidateForm">
<tr><td></td>
<td><Input type="hidden" name="addrec" value="addrec">
</td></td>
<tr>
<tr><td>Currency Type:</td>
<td><Input type="text" name="strcurrency" size="10">
</td></td>
<tr>
<tr><td>Value to GBP:</td>
<td><Input type="text" name="strvalue" size="10">
</td></td>
<tr>
<tr>
<td></td><td><input type="submit" name="cmdValidate" value="Add"><space><space>
<input type="button" value="Cancel" onclick=location.href="/exrate"></td>
<br>
<br>
</tr>
<tr>
</form>
</table>
exrate.asp:
<html>
<head>
<title>Exchange Rate List</title></head>
<body bgcolor="white" text="black">
<%
Dim rsExRate
Dim strSQL
Dim lngRecordNo
lngRecordNo = CLng(Request.QueryString("ID"))
Set rsExRate = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT tblexchange.* FROM tblexchange;"
rsExRate.Open strSQL, conn
Response.Write ("<table width='400px' border='0'>")
Response.Write ("<tr>")
Response.Write ("<th align='Left'>CURRENCY</th>")
Response.Write ("<th align='Left'>EXCH RATE</th>")
Response.Write ("<th align='Left'>DEL</th>")
Response.Write ("</tr>")
Do While Not rsExRate.EOF
Response.Write ("<tr>")
Response.Write ("<td align='Left'>")
Response.Write ("<a href=""expcmd.asp?ID=" & rsExRate("ID") & """>")
Response.Write (rsExRate("strcurrency"))
Response.Write ("</td>")
Response.Write ("<td align='Left'> ")
Response.Write (rsExRate("strvalue"))
Response.Write ("</td>")
Response.Write ("<td align='left'>")
Response.Write ("<a href=""expcmd.asp?ID=" & rsExRate("ID") & """>")
Response.Write ("Delete")
Response.Write ("</td>")
Response.Write ("<tr>")
rsExRate.MoveNext
Loop
Response.Write ("</table>")
rsExRate.Close
Set rsExRate = Nothing
Set adoCon = Nothing
Set conn = Nothing
%>
" New To Programming - Learning Fast