Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Nedd help with page refresh sending recent input each time

Status
Not open for further replies.

DougP

MIS
Dec 13, 1999
5,985
US
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

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">&nbsp;
		<%'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">&nbsp;
	         <%Response.write Rs3.fields("TotalRecs")%>
	          &nbsp;</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")%>&nbsp;</td>
			<td><%Response.write RS1.fields("Lastname")%>&nbsp;</td>
			<td><%Response.write RS1.fields("PickupTime")%>&nbsp;</td>
			</tr>
			<%RS1.movenext
			loop 			
		set Conn =nothing
		set Rs1 = nothing
		set Rs2 = nothing
		set Rs3 = nothing

	
	End if%>
	
	</table>
	
	</form>

DougP
 
Redirect with a 302 response after submission has been processed.

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top