RSS Forums RSS
Please support our ASP advertiser: Lunarpages ASP Web Hosting
Views: 1706 | Replies: 2 | Solved
Reply
Join Date: Apr 2006
Posts: 3
Reputation: prats_20 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
prats_20 prats_20 is offline Offline
Newbie Poster

retrieving a web page from database

  #1  
Apr 23rd, 2006
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>
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jul 2004
Location: Sydney, Australia
Posts: 166
Reputation: Lafinboy is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 7
Lafinboy's Avatar
Lafinboy Lafinboy is offline Offline
Junior Poster

Re: retrieving a web page from database

  #2  
Apr 24th, 2006
What's the question?
If I've been a help please confirm by clicking the Add to Lafinboy's Reputation link in the header of this reply.

Lafinboy Productions
:: Website Design :: Website Development ::

Reply With Quote  
Join Date: Apr 2006
Posts: 3
Reputation: prats_20 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
prats_20 prats_20 is offline Offline
Newbie Poster

Re: retrieving a web page from database

  #3  
Apr 24th, 2006
Originally Posted by Lafinboy
What's the question?
the question is how to display the page with the table on it.that is i have to display a greeting n the form to allow people send the greeting at the bottom.how u do that?
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 3:58 am.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC