The page works fine but if I refresh the page it submit the last item chosen in the drop down again. Each subsequetn page refresh adds it again. I want to be able to allow page refresh so the page can see new items entered that may not have come from this page.
How can I set it to "" so when it refreshes it won't do anything?
E
DougP
How can I set it to "" so when it refreshes it won't do anything?
E
Code:
<body>
<form Name="myForm" method="POST" action="<%=MyPickup%>">
<%
name=request.form("Name")
ListCleared=request.QueryString("ListCleared")
Set Conn = server.CreateObject("ADODB.Connection")
Set RS1 = Server.CreateObject("ADODB.Recordset")
Set RS2 = Server.CreateObject("ADODB.Recordset")
Set RS3 = Server.CreateObject("ADODB.Recordset")
Conn.Open "driver=SQL Server;server=000.000.000.000;uid=login;pwd=Password;database=mydb;"
'load combo box
SQLString1 = "Select * From Names Order by Lastname;"
RS2.Open SQLString1, Conn
RS2.movefirst%>
<font size="5">
<select name="names" size=1 onChange="javascript: document.forms['myForm'].submit()" style="font-family: Arial; font-size: 14pt">
<option selected value="Choose">Choose</option>
<%do while not rs2.EOF%>
<option value="<%Response.write RS2.fields("Lastname")%>"><%Response.write RS2.fields("Lastname")%></option>
<%RS2.movenext
loop%>
</select></font> <font size="5">
<%'insert into database only if name is not blank
response.write "name : " & name
If name = "" or name = "Choose" then
response.write "Add a name"
Else
SQLString = "Insert into Transactions (Tag,Lastname,Firstname,Position) Select Tag,Lastname,Firstname,0 as Position From Thenames Where Lastname = '" & name & "'"
RS1.Open SQLString, Conn
'refresh table
SQLString = "Select * from Transactions Order by PickupTime DESC;"
RS1.Open SQLString, Conn
'get record count
SQLString3 = "Select count(*) TotalRecs from Transactions;"
RS3.Open SQLString3, Conn
%>
</font>
<Table Border="1" cellspacing="0" style="font-family: Arial; font-size: 18pt; border-collapse: collapse" bordercolor="#111111" cellpadding="0" >
<tr>
<td bgcolor="#008080"><font color="#FFFFFF">Total Recs</font></td>
<td bgcolor="#008080" colspan="2" align="center">
<font color="#FFFFFF">
<%Response.write Rs3.fields("TotalRecs")%>
</font></td>
</tr>
<tr>
<td bgcolor="#C0C0C0">Position</td>
<td bgcolor="#C0C0C0">Name</td>
<td bgcolor="#C0C0C0">PickupTime</td>
</tr>
<%RS1.movefirst
do while not rs1.EOF%>
<tr>
<td><%Response.write RS1.fields("Position")%> </td>
<td><%Response.write RS1.fields("Lastname")%> </td>
<td><%Response.write RS1.fields("PickupTime")%> </td>
</tr>
<%RS1.movenext
loop
set Conn =nothing
set Rs1 = nothing
set Rs2 = nothing
set Rs3 = nothing
End if%>
</table>
</form>
DougP