Results 1 to 6 of 6
  1. #1
    Join Date
    Apr 2004
    Posts
    50

    Unanswered: Refreshing a form without logging out and logging back in

    Hi There can some one help me with this bit of code

    I have a form for people to update their details and in the update.asp file which run when the user clicks on the update button
    i want the details on the form to refresh before the user gets redirected back to the form so they can see the changes with out having to log out and in again

    here the code for my update file

    <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
    <!-- #INCLUDE FILE="Classfd.asp" -->
    <%
    Dim rsUser
    Set rsUser = Server.CreateObject ("ADODB.Recordset")
    rsUser.Open "tbl_User", objConn, adOpenForwardOnly, adLockOptimistic, adCmdTable
    rsUser ("Password") = Request.Form ("Password")
    rsUser ("FirstName") = Request.Form ("FirstName")
    rsUser ("Surname") = Request.Form ("Surname")
    rsUser ("DOB") = Request.Form ("DOB")
    rsUser ("Address1") = Request.Form ("Address1")
    rsUser ("Address2") = Request.Form ("Address2")
    rsUser ("Address3") = Request.Form ("Address3")
    rsUser ("Address4") = Request.Form ("Address4")
    rsUser ("PostCode") = Request.Form ("PostCode")
    rsUser ("Country") = Request.Form ("Country")
    rsUser ("Email") = Request.Form ("Email")
    If Request.Form ("DifferentAddress") = "1" Then
    rsUser ("DifferentAddress") = True
    Else
    rsUser ("DifferentAddress") = False
    rsUser ("dAddress1") = Request.Form ("dAddress1")
    rsUser ("dAddress2") = Request.Form ("dAddress2")
    rsUser ("dAddress3") = Request.Form ("dAddress3")
    rsUser ("dAddress4") = Request.Form ("dAddress4")
    rsUser ("dPostCode") = Request.Form ("dPostCode")
    rsUser ("dCountry") = Request.Form ("dCountry")
    rsUser.update
    End If
    Response.Redirect "MyAccount.asp"
    %>

    Does anyone have any ideas !
    ( I thought of ending the session then re-opening it agian but i was not sure how to do this, am I Thinking along the right lines or is there a better way of doing this)

    Hope Some Out There Can Help

    Regards

    KlansMan

  2. #2
    Join Date
    Aug 2004
    Posts
    96
    I think the best would be to allow access to your update page to logged in users only so when they submit the form they are still logged in, if you think they will spend a long time on the form then you can extend the Session time out.

  3. #3
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    Sounds to me like you just need to change your logic flow a little bit...

    You are submitting back to the same page yes? If so you just need to make it so it checks for updated data first, does an update if needed and then, gets the data and displays it.... in psuedo code something like...
    Code:
    if request.form("doUpdate") then
      update database with new info
    end if
    
    get info from database
    
    display info

  4. #4
    Join Date
    Jul 2003
    Location
    SoCal
    Posts
    721
    KlansMan? Like, THEE Klan.. I surely hope not...
    That which does not kill me postpones the inevitable.

  5. #5
    Join Date
    Apr 2004
    Posts
    50
    Cheers for the bit of advice i'll give it a go

    And No it not THEE KLAN.
    As in a Scottish Klan.The Klan Mcphee

    rokslide

    The Form they fill in is MyAccount.asp which they get redirected back to once Update.asp has ran and placed the new information in the datebase
    So is there a refresh command which i could place in myAccount.asp just before the form to show any changes

    Cheers

    KlansMan

  6. #6
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    Sounds like you have a problem with caching... add these lines to the start of your page...
    Code:
    <% Response.CacheControl = "no-cache" %>
    <% Response.AddHeader "Pragma", "no-cache" %> 
    <% Response.Expires = -1 %>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •