Forums
This topic is locked
how can add data from one form to another
Posted 27 Oct 2007 09:34:30
1
has voted
27 Oct 2007 09:34:30 sanjeev jha posted:
i want to transfer data of top_id in to table automatic when submit reply
and count reply how many reply on that topic id
<%@language=vbscript%>
<%option explicit%>
<%
dim my_conn_stRing, conn,R,R1, sql,Rcount,Rpage,page,i,stroutput,repcount,reply,topid,stropt
MY_CONN_STRING = "dsn=oracle;uid=starter;pwd=starter;"
Set Conn = server.createobject("ADODB.Connection"
Conn.open MY_CONN_STRING
set R = Server.CreateObject("ADODB.Recordset"
sql= "SELECT top_id, top_sub,launch_by,launch_dt from topmaster order by top_id "
R.Open SQL, Conn, 3, 1, &H0001
R.PageSize=5
Repcount=R.RecordCount
Rcount=R.RecordCount
Rpage=R.PageCount
if Request.QueryString("Reply"="" then
Reply=1
else
Reply=cint((Request.QueryString("Reply"))
end if
if Request.querystring("page"="" then
page=1
else
page=cint((Request.querystring("page"))
end if
%>
<html>
<head><TITLE>VOICE OF BARAUNIANS</TITLE></head>
<body>
<!--#include file="front.inc"--><br><br>
<div style="Position:Absolute; width:970; TOP:100; left:15>
<meta http-equiv="Content-Type" content="text/html; charet=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" margin width=0 margin height=0>
<form action="brvoice.asp" method="post">
<table width="980" border="0" cellspacing="1" cellpadding="3" bgcolor="#000000">
<tr bgcolor="#CCCCFF">
<td >TOPIC ID</td>
<td bgcolor="#CCCCFF" colspan="100%">TOPIC SUBJECT</td>
<td bgcolor="#CCCCFF">POSTED BY</td>
<td bgcolor="#CCCCFF">POSTED DATE</td>
<td bgcolor="#CCCCFF">REPLY</td>
</tr>
<%
if not R.eof then
R.Move (page-1)*R.pagesize
end if
if not R.eof then
for i=1 to R.pagesize%>
<tr bgcolor="#FFFFFF">
<td><%=R("top_id"%></td>
<td align="left" colspan="100%"><font face="arial" size=2><a href=voice.asp?opt=<%=R("top_id"%><%=R("top_sub"%><%=R("launch_by"%><%=R("launch_dt"%>><%Response.Write R("top_sub"%></a></font></td>
<td><%=R("launch_by"%></td>
<td><%=R("launch_dt"%></td>
<td><a href=voicereply.asp?opt2=<%=R("top_id"%><%=R("top_sub"%><%=R("launch_by"%><%=R("launch_dt"%>>Reply</a></td>
</tr>
<%
if request.QueryString("opt" then
stropt=opt
response.form("vtopid"= response.write & Request.QueryString(stropt)
end if
if request.QueryString("opt2" then
stropt1=opt1
end if
R.movenext
If R.EOF Then
Exit For
end if
next
end if%>
</table>
<table width="500" border="0" cellspacing="1" cellpadding="3" >
<tR align="right" bgcolor="#FFFFFF">
<td> <%If page>1 Then %> <a href="brvoice.asp?page=<%=page-1%>">Previous</a>
<%end if %>
<% If page < rpage Then %> <a href="brvoice.asp?page=<%=page+1%>">Next</a>
<% end if %>
<%if rpage>2 then
for i=1 to Rpage
Response.write "<a href=""brvoice.asp?page="&i&""">"&i&"</a> "
next
end if%> </td>
</tr>
</table>
<table width=765>
<tr>
<td align='Right'><input type="button" name="submit" value="Back" onclick="brvoice()"></td>
<td><input type ="button" value="EXIT" onClick="window.close()"></td>
</tr>
</table>
<script language="Javascript">
function brvoice()
{
window.location = "brvoice.asp"
}
function Reply()
{
window.location = "voiceReply.asp"
}
function voice()
{
window.location = "voice.asp"
}
function newtopic()
{
window.location = "newtopic.asp"
}
</script>
</form>
</body>
</html>
<% R.Close()%>
<%@ Language=VBScript%>
<%Option Explicit%>
<html>
<head>
<title>Voice of baraunians</title>
<!--#include file="front.inc"-->
</head>
<body>
<div style="Position:Absolute; top:'100'; left:'20'; width:'970'; height:'472'; background-color:'skyblue'">
<form method="post" action="voicereply.asp">
<%
Dim R,r1, stropt2,stropt
Dim vrepby,vtopid,vrepid,vrepdt,vreply,errorMsg,conn,i
Set conn = Server.Createobject("ADODB.Connection"
conn.Open "DSN=ORACLE; User ID = STARTER; Password = STARTER"
Set R = Server.CreateObject("ADODB.Recordset"
Set R1 = Server.CreateObject("ADODB.Recordset"
Set R1 = Conn.Execute("SELECT top_id, top_sub, launch_by, launch_dt, msg FROM topmaster "
%><br>
<center><b><font face="arial"><h2>POST YOUR REPLY</h2></font></b></center>
<hr>
<p>
<div style="position:absolute; left:'180'; top:'90'; z-index:0">
<table border=0 width=400 >
<%
For Each stropt in Request.QueryString
%>
<tr><TD ><th><font face="monotype corsiva"><b>Topic ID</b></center></font></th></TD><%Response.Write "<td>" & Request.QueryString(stropt) & "</td></tr>"%>
</tr>
<%next%>
</table>
</div>
<%
R.Open "Select rep_id from topic order by rep_id", conn, adOpenStatic, adLockOptimistic, adCmdText
If R.Recordcount > 0 Then
R.Movelast
vrepid = R("rep_id"
vrepid = CInt(vrepid) + 1
Else
vrepid = 1
End if
R.Close
If Not IsEmpty(Request.Form("submit") then
stropt=request.form("stropt"
vreply = Request.Form("vreply"
stropt=trim(stropt)
vrepid = trim(vrepid)
vreply = trim(vreply)
If len(errorMsg) = 0 Then
If len(vreply) = 0 Then
errorMsg = "Your must enter your Reply"
Elseif len(vreply) > 500 Then
errorMsg = "The voice you are entered is not longer than 500 characters. Please reduce the size."
End If
End If
If len(errorMsg) = 0 Then
conn.Close
conn.Mode = adModeReadWrite
conn.Open
R.Open "Select * from topic ", conn, adOpenStatic, adLockOptimistic, adCmdText
R.Addnew
R("top_id" = request.cookies(stropt)
R("rep_id" = vrepid
R("rep_by" = request.cookies("userid"
R("rep_dt" = Cdate(now())
R("reply" = vreply
R.UPdate
R.Close
end if
end if
If len(errorMsg) > 0 Then
Response.Write "<p><b><font color='red'>" & errorMsg & "</font></b></p>"
End If
%>
<script language = "javascript">
function brvoice()
{
window.location = "brvoice.asp"
}
</script>
<div style="position:absolute; left:0; top:250; z-index:0">
<table width=820>
<tr>
<table align="center">
<tr>
<input type="hidden" name="vtopid" value="<%=stropt%>">
<td align="right"><font face="arial" size=2><b>Reply : </b></font></td>
<td align='left'><input type="text" style="width:400px" style= "height:100px" name="vreply"></td>
</tr>
</table>
</tr>
<tr>
<table align="center">
<tr>
<td align="center"><input type="Submit" name="submit" value="Save">
<td><input type="reset" name="reset" value="Reset"></td>
<td><input type="button" name="Back" value="Back" onclick="brvoice()"></td>
<td><input type ="button" value="EXIT" onClick="window.close()"></td>
</td>
</tr>
</table>
</tr>
</table>
</div>
</form>
</body>
</html>