hi
i have to retrieve a webpage from database given i have the id which is passed to that page as q querystring.
here is my code
ave 2 pages
the one where u clik on hyperlink
<<A href="mailto:%@LANGUAGE="VBSCRIPT">%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<% dim objConn, objRS
Set objConn=Server.CreateObject("ADODB.Connection")
objConn.open="Provider=Microsoft.Jet.OLEDB.4.0; Data Source= D:\Datastores\greeting.mdb"
Set objRS=Server.CreateObject("ADODB.Recordset")
objRS.open "Greetings", objConn
dim sql
sql="Select * from Greetings"
objConn.execute(sql)
%>
<html>
<head>
<title>Birthday Menu</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<center>
<table height="50%">
<% while not objRS.eof
response.Write("<tr><td><a target=""main1"" href=""greeting.asp?id="&objRS("ID")&""">"&objRS("Name")&"</a></td></tr>")
objRs.MoveNext
wend
%>
</table>
</center>
</body>
</html>
-------------------------the one where u display the page
<<A href="mailto:%@LANGUAGE="VBSCRIPT">%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<% Dim objConn, objRS, sql
if request.QueryString("ID")<> "" then
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open = "Provider = Microsoft.Jet.OLEDB.4.0; Data Source = D:\Datastores\greeting.mdb"
Set objRS=Server.CreateObject("ADODB.RecordSet")
objRS.open "Greetings", objConn
sql="select * from Greetings where id="&request.QueryString("ID")&""
objConn.Execute(sql)
else
if request.Form("btn_send")<>"" then
response.Redirect("birthday.asp")
else
response.redirect("main1.asp")
end if
end if
%>
<html>
<head>
<title>greeting</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" name="style1" href="styles/style1.css">
<script language="JavaScript">
function validate(form)
{
var str="";// initailising empty string
str=str+checkemail(form.txt_semail.value);
str=str+checkemail(form.txt_remail.value);
str=str+checkmessage(form.txt_message.value);
//only if string is not null, alert will appear
if (str != "")
{
alert(str);
return (false);
}//end of if
else
return (true);
}//end of validate
function checkemail(string)
{
var error="";
if(string=="")
error="Email must be filled.\n";
var email=/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/
if (!(email.test(string)))
error="Put a valid email address.\n";
return error;
}
function checkmessage(string)
{
var error="";
if(string=="")
error="Message should be provided.\n";
return error;
}
</script>
</head>
<body>
<center>
<form action="greeting.asp" method="post" onSubmit="return validate(this)" name="greeting">
<table>
<% while not objRS.eof
if ""&objRS("ID")&""=""&request.QueryString("ID")&"" then
response.write(""&objRS("Page")&"")
response.Write("<br><tr><td>Sender Email</td><td>:</td><td><input type=""text"" name=""txt_semail""></td></tr><tr><td>Recipient Email</td><td>:</td><td><input type=""text"" name=""txt_remail""></tr><tr><td>Message</td><td>:</td><td><textarea name=""txt_message"" rows=""5"" cols=""35"" wrap=""soft""></textarea></td></tr><tr><td colspan=""3"" align=""center""><input type=""submit"" value=""Send"" name=""btn_send""></td></tr>")
end if
objRS.MoveNext
Wend
%>
</table>
</form>
</center>
</body>
</html>