Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...Thanks for a great forum. My problem was answered just by scrolling through previously solved problems. Great service!!..."

Geography

Where in the world do Tek-Tips members come from?

Nedd help with page refresh sending recent input each time

DougP (MIS)
8 May 12 22:37
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
 

ChrisHirst (IS/IT--Management)
10 May 12 9:15
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

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close