View Full Version : record problem!!!

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")


haha = request("a")
subop2 = request("subop2")
subop6 = request("subop6")
subop8 = request("subop8")
subop10 = request("bank")
valamount = frmValidateNumber("amount")
valemail = true

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


if haha = "cancel" then


if haha = "passup" then

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

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

if valamount="" or valamount=false then
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

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


end if
end if
end if
end if
end if


<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)

<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');
var text = document.createTextNode(MONTHS[x]+' '+thisYear);

<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;

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

<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>
<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>
</Select><% if subop10="empty" then%><span class="red">*</span><% end if %></td>

<td>Payment Date:</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>
<td width="14" align="left">-</td>

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

<td align="center">dd</td>
<td align="left">-</td>
<td>mm, yyyy</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>

<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>

<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>
<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 %>
<input type="hidden" name="a">
<table border="1" align="center">
<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;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>
<form action="../../../index.asp">
<input type="submit" value="Back to Main">
<script language="vbscript">
sub change(operation)
end sub

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??