...

View Full Version : record problem!!!



tanhaha_how
02-23-2006, 10:00 AM
hello....help me please!!!



<!-- #include file = "../SharedScripts/include.asp" -->
<%
Response.AddHeader "Progma", "no-cache"
Response.AddHeader "cache-control", "no-store"
Response.Buffer = True
Response.ExpiresAbsolute = Now() - 1
Response.Expires = 0
Response.CacheControl = "no-cache"

dim haha, valemail, subop2,subop6,subop8,subop10,subop15

Set objRS3 = Server.CreateObject("ADODB.Recordset")
Set objRS4 = Server.CreateObject("ADODB.Recordset")
Set objRS5 = Server.CreateObject("ADODB.Recordset")
Set objRS6 = Server.CreateObject("ADODB.Recordset")
Set objRS7 = Server.CreateObject("ADODB.Recordset")
Set objRS8 = Server.CreateObject("ADODB.Recordset")
Set objRS9 = Server.CreateObject("ADODB.Recordset")
Set objRS10 = Server.CreateObject("ADODB.Recordset")

minYear=1900
maxYear=2100

haha = request("a")
subop2 = request("subop2")
subop6 = request("subop6")
subop8 = request("subop8")
subop10 = request("bank")
c=request("amount")
d=request("email")
b=request("txtDate1")
e=request("txtDate2")
f=request("txtDate3")
valamount = frmValidateNumber("amount")
valemail = true

sql = "select * from tbluser where email = '"&request("email")&"'"
set objRS7 = objConn.Execute(sql)

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

if haha = "cancel" then
c=""
d=""

else

if haha = "passup" then

if request("bank")="none" then
subop10="empty"
end if

if request("txtDate1")="0" or request("txtDate2")="0" then
subop8="errordate"
end if

if valamount="" or valamount=false then
subop6="erroramount"
end if

valemail = frmValidateEmail("email")
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
txtDate3 = DatePart("yyyy", Date())

if valemail = true and request("bank") <> "none" and valamount <> "" and valamount = true then
if subop2="" then
' === Begin of generation ===
' sql = "Select COUNT(paymentID) AS total from tblpayment"
' objRS4.open sql, objConn
' totalPay = objRS4("total")

' sql = "Select p.*,b.* from tblpayment p,tblbank b Where b.nameOfBank='" & request("bank") &"' and p.paymentDate='" & request("txtDate2") & "-"& request("txtDate1") & "-" & txtDate3 & "' and p.email='" &request("email") & "'"
' objRS5.open sql, objConn
' if objRS5.eof then
' objRS4.close
sql = "Select * from tblbank where nameOfBank like '" & request("bank") & "%'"
objRS9.open sql, objConn

if request("email") <> "" then

sql = "Select * from tblbank where nameOfBank='" & request("bank") &"'"
objRS3.open sql, objConn

Do while not objRS3.eof
bankid = objRS3("bankID")

call UStoMal(hours,AMPM,Dates,mins)
Date3 = Dates-1
mth=month(Date3)
yr=year(Date3)
dy=day(Date3)
Date5=yr&"-"&mth&"-"&dy

sql = "INSERT INTO tblpayment(paymentDate,amountPaid,email,postedDate,bankID) VALUES('" & txtDate3 & "-"& request("txtDate1") & "-" & request("txtDate2") & "','" & request("amount") & "','" & Server.HTMLEncode(request("email")) & "','"& Date1 &"','"& bankid &"')"
objRS4.open sql, objConn

response.Redirect("backmsg.asp")

objRS3.movenext
loop
end if
end if
end if
end if
end if

%>

<html>
<head>
<SCRIPT language=Javascript>
//only allow numbers.
// function isNumberKey(evt)
// {
// var charCode = (evt.which) ? evt.which : event.keyCode
// if (charCode > 31 && (charCode < 48 || charCode > 57))
// return false;
// return true;
// }
//only allow numbers and dot(.)
function isNumberKey(evt)
{
if(!((event.keyCode>=48&&event.keyCode<=57)||(event.keyCode==46)))
event.returnValue=false;
}
</SCRIPT>

<script type="text/javascript">
function addMonths() {
var MONTHS=["Jan ", "Feb ", "Mar ", "Apr ", "May ", "Jun ", "Jul ", "Aug ", "Sep ", "Oct ", "Nov ", "Dec "];
var today=new Date();
var thisYear=today.getFullYear();
var thisMonth=today.getMonth();
for (var x=0; x<=thisMonth; x++) { // Use this if you want January to be first
//for (var x=thisMonth; x>=0; x--) { // Use this if you want the current month to be first
var option = document.createElement('option');
option.value=thisMonth+1;
var text = document.createTextNode(MONTHS[x]+' '+thisYear);
option.appendChild(text);
document.getElementById('months').appendChild(option);
}
}
</script>

<script type="text/javascript">
var today = new Date();
var ty=today.getFullYear();
var tm=today.getMonth();
var td=today.getDate();
//var mes ='Please, select a valid date';
var mes ='Please, select a valid date';
var mes1 ='Please, future date not allowed';
function validate(){
var pm = document.getElementById('months').selectedIndex-1;
var nd = document.getElementById('dates').selectedIndex-1;
if(pm<0||nd<0){alert(mes);return false}
var pd = Number(document.getElementById('dates').value);
var pdate = new Date(ty,pm,pd);
if(pdate.getDate()!=pd){alert(mes);return false}
if(pdate>=today){alert(mes1);return false}
}
onload = function(){
var m = document.getElementById('months').getElementsByTagName('option');
var d = document.getElementById('dates').getElementsByTagName('option');
for(var i=1;i<m.length;i++){
m[i].value+=' '+ty;
m[i].text+=' '+ty;
}
}
</script>

<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body onload="addMonths();">
<center><b>Bank Payment</b></center>
<form name="form" action="clickhere.asp" method="post" onsubmit="return validate()">
<table align="center" border=0>
<tr>
<td width="88">Bank:</td>
<td width="24"></td>
<td colspan="5"><Select name="bank">
<option value="none" <%if haha="cancel" then%>selected<%end if%>> --- </option>
<%
sql = "Select * from tblbank order by bankID"
objRS.open sql, objConn

Do while not objRS.eof
bankName = Split(objRS("nameOfBank"),"-")
realBankName = bankName(LBound(bankName))
%>
<option value="<%=Server.HTMLEncode(realBankName)%>" <% if request("bank")=CStr(realBankName) and haha<>"cancel" then %>selected <% end if %>><%=Server.HTMLEncode(realBankName)%></option>
<%
objRS.movenext
loop
%>
</Select><% if subop10="empty" then%><span class="red">*</span><% end if %></td>
</tr>

<tr>
<td>Payment Date:</td>
<td></td>
<td width="48"><select name="txtDate2" id="dates">
<option value="0">---</option>
<option value="1">01</option>
<option value="2">02</option>
<option value="3">03</option>
<option value="4">04</option>
<option value="5">05</option>
<option value="6">06</option>
<option value="7">07</option>
<option value="8">08</option>
<option value="9">09</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="14">14</option>
<option value="15">15</option>
<option value="16">16</option>
<option value="17">17</option>
<option value="18">18</option>
<option value="19">19</option>
<option value="20">20</option>
<option value="21">21</option>
<option value="22">22</option>
<option value="23">23</option>
<option value="24">24</option>
<option value="25">25</option>
<option value="26">26</option>
<option value="27">27</option>
<option value="28">28</option>
<option value="29">29</option>
<option value="30">30</option>
<option value="31">31</option>
</select></td>
<td width="14" align="left">-</td>

<td width="102">
<select name="txtDate1" id="months">
<option>---</option>
</select>
<% if subop8="errordate" then%><span class="red">*</span><% end if %>
</td>
<td width="0" align="center"></td>
<td width="108">
</td>
</tr>

<tr>
<td></td>
<td></td>
<td align="center">dd</td>
<td align="left">-</td>
<td>mm, yyyy</td>
</tr>

<tr>
<td>Amount:</td>
<td>RM</td>
<td colspan=5><input type="text" name="amount" onkeypress="return isNumberKey(event)" value="<%if haha<>"cancel" then%><%=server.HTMLEncode(request("amount"))%><%end if%>"><% if subop6="erroramount" then %><span class="red">*</span><% end if %></td>
</tr>

<tr>
<td>Email:</td>
<td></td>
<td colspan=5><input type="text" name="email" size=40 value="<%if haha<>"cancel" then%><%=server.HTMLEncode(request("email"))%><%end if%>"><% if subop5="invalidEmail" or valemail = false then %><span class="red">*</span><% end if %></td>
</tr>

<tr>
<td colspan=7 align="center"><input type="submit" value="Submit" onclick=change("passup")>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="button" value="Cancel" onclick=change("cancel")></td>
</tr>
<tr>
<td align="center" colspan=7>
<% if subop10="empty" then%>Please select a bank.<br><br><% end if %>
<% if subop8="errordate" then%>Please enter a valid date.<br><br><% end if %>
<% if subop6="erroramount" then%>Please enter an amount.<br><br><% end if %>
<% if valemail=false or subop5="invalidEmail" then%>Please enter a valid email.<br><br><% end if %>
</td>
</tr>
</table>
<input type="hidden" name="a">
</form>
<br>
<table border="1" align="center">
<tr>
<td>
<b>&nbsp;&nbsp;IMPORTANT NOTICE</b><br><br>
&nbsp;&nbsp;Please note that activation keys will ONLY be sent to you upon receiving copies of&nbsp;&nbsp;<br>&nbsp;&nbsp;your deposit slips<br><br>
&nbsp;&nbsp;via fax<br>
&nbsp;&nbsp;Fax No.: 04-2278 718<br>
&nbsp;&nbsp;OR<br><br>
&nbsp;&nbsp;by post<br>
&nbsp;&nbsp;addressed to: Our-science.com Sdn. Bhd. (521441-V)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;18-13-G, Gurney Tower,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Gurney Drive,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;10250 Penang.<br><br>
&nbsp;&nbsp;However, if you do NOT RECEIVE your activation keys 7 days after sending us&nbsp;&nbsp;<br>
&nbsp;&nbsp;your copy of deposit slips, please contact us via EMAIL at info@icdsites.com<br>
</td>
</tr>
</table>
<center>
<form action="../../../index.asp">
<input type="submit" value="Back to Main">
</form>
</center>
</body>
</html>
<script language="vbscript">
<!--
sub change(operation)
form.a.value=operation
form.submit
end sub
</script>


when the first time user enter the record, it will only store 1 record.....
second time...another user enter the record...it will store TWO exactly the same record in mysql.....

anything wrong with my code??



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum