URGENT session problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lyealain
    New Member
    • May 2007
    • 102

    URGENT session problem

    hi...
    assume that in pageA i have a dropdown box.., so when i click the value in the dropdown box.. and the value will come out in the textbox below..

    <input type="textbox" name= "date1" value=<%rsGet.f ield("date")%> >

    so if i want to update that date in the textbox.. the update query is in page B

    if the value is correct then .. fine.. can update...

    but if let say value is wrong..
    page B
    [PHP]session("date") = request.form ( " date1" )
    if session(" date ") = " KAKAKA"
    response.redire ct(" pageA.asp?res=D ateBlank")[/PHP]

    HOW DO I MAINTAIN THE DATA FOR KAKAKA WHICH USER JUST KEY IN TO PAGE A...


    it is because in pageA... that textbox data is called from database....

    how to put the session(" date") in that textbox ???????????

    PLS HELP ... THANKS THANKS
  • lyealain
    New Member
    • May 2007
    • 102

    #2
    pls help........... ............

    Comment

    • danp129
      Recognized Expert Contributor
      • Jul 2006
      • 323

      #3
      Originally posted by lyealain
      hi...
      assume that in pageA i have a dropdown box.., so when i click the value in the dropdown box.. and the value will come out in the textbox below..

      <input type="textbox" name= "date1" value=<%rsGet.f ield("date")%> >

      so if i want to update that date in the textbox.. the update query is in page B

      if the value is correct then .. fine.. can update...

      but if let say value is wrong..
      page B
      [PHP]session("date") = request.form ( " date1" )
      if session(" date ") = " KAKAKA"
      response.redire ct(" pageA.asp?res=D ateBlank")[/PHP]

      HOW DO I MAINTAIN THE DATA FOR KAKAKA WHICH USER JUST KEY IN TO PAGE A...


      it is because in pageA... that textbox data is called from database....

      how to put the session(" date") in that textbox ???????????

      PLS HELP ... THANKS THANKS
      [CODE=asp]<%
      Dim dteUserDate
      if session("date") <>"" then dteUserDate=ses sion("date") else dteUserDate=rsG et.field("date" )
      %>
      <input type="textbox" name= "date1" value=<%=dteUse rDate%>>[/CODE]

      Personally I tend to keep everything on one page and use session variables sparingly since the memory holding the session variables will be taken up until the session times out.

      Comment

      • lyealain
        New Member
        • May 2007
        • 102

        #4
        which mean in page B i put

        [PHP]if session(" date ") = " KAKAKA"
        response.redire ct(" pageA.asp?res=D ateBlank")[/PHP]
        in page A i put

        [PHP]<%
        Dim dteUserDate
        if session("date") ="KAKAKA" then dteUserDate=ses sion("date") else dteUserDate=rsG et.field("date" )
        %>
        <input type="textbox" name= "date1" value=<%=dteUse rDate%>[/PHP]

        but in page B i have a lot of
        [PHP]if session(" date ") = " KAKAKA"
        response.redire ct(" pageA.asp?res=D ateBlank")[/PHP]

        [PHP]if session(" date2 ") = " KAKAKA"
        response.redire ct(" pageA.asp?res=D ateBlank")[/PHP]

        [PHP]if session(" date3 ") = " KAKAKA"
        response.redire ct(" pageA.asp?res=D ateBlank")[/PHP]
        ..........
        ..........
        ............

        so in page A..
        <%
        Dim dteUserDate
        if session("date") ="KAKAKA" then dteUserDate=ses sion("date") else dteUserDate=rsG et.field("date" )
        %>

        <%
        Dim dteUserDate
        if session("date2" )="KAKAKA" then dteUserDate=ses sion("date2") else dteUserDate=rsG et.field("date2 ")
        %>

        need to declare like that ????

        Comment

        • danp129
          Recognized Expert Contributor
          • Jul 2006
          • 323

          #5
          Originally posted by lyealain
          which mean in page B i put

          [PHP]if session(" date ") = " KAKAKA"
          response.redire ct(" pageA.asp?res=D ateBlank")[/PHP]
          in page A i put

          [PHP]<%
          Dim dteUserDate
          if session("date") ="KAKAKA" then dteUserDate=ses sion("date") else dteUserDate=rsG et.field("date" )
          %>
          <input type="textbox" name= "date1" value=<%=dteUse rDate%>[/PHP]

          but in page B i have a lot of
          [PHP]if session(" date ") = " KAKAKA"
          response.redire ct(" pageA.asp?res=D ateBlank")[/PHP]

          [PHP]if session(" date2 ") = " KAKAKA"
          response.redire ct(" pageA.asp?res=D ateBlank")[/PHP]

          [PHP]if session(" date3 ") = " KAKAKA"
          response.redire ct(" pageA.asp?res=D ateBlank")[/PHP]
          ..........
          ..........
          ............

          so in page A..
          <%
          Dim dteUserDate
          if session("date") ="KAKAKA" then dteUserDate=ses sion("date") else dteUserDate=rsG et.field("date" )
          %>

          <%
          Dim dteUserDate
          if session("date2" )="KAKAKA" then dteUserDate=ses sion("date2") else dteUserDate=rsG et.field("date2 ")
          %>

          need to declare like that ????
          I'd prolly do something like this on page A

          Code:
          Dim dteUserDate
          Dim dteUserDate2
          Dim dteUserDate3
          if session("date")="KAKAKA" then dteUserDate=session("date") else dteUserDate=rsGet.field("date")
          if session("date2")="KAKAKA" then dteUserDate2=session("date2") else dteUserDate=rsGet.field("date2")
          if session("date3")="KAKAKA" then dteUserDate3=session("date3") else dteUserDate=rsGet.field("date3")
          
          ...
          
          <input type="textbox" name="date1" value=<%=dteUserDate%>
          <input type="textbox" name="date2" value=<%=dteUserDate2%>
          <input type="textbox" name="date3" value=<%=dteUserDate3%>

          Comment

          • lyealain
            New Member
            • May 2007
            • 102

            #6
            thanks... but for my page A /.. i have a form..
            ...
            [PHP]<form action="???" enctype="multip art/form-data" method="post">
            <input type="textbox" name="date1" value=<%=dteUse rDate%>
            <input type="textbox" name="date2" value=<%=dteUse rDate2%>
            <input type="textbox" name="date3" value=<%=dteUse rDate3%>[/CODE][/QUOTE]


            <tr>
            <td>&nbsp&nbs p</td>
            <td width="100"><FO NT FACE="Arial" SIZE="2" COLOR="#000000" ><B>Upload Image</font></td>
            <TD BGCOLOR="#EEEEE E">

            <INPUT TYPE="file" NAME="myFile" name="file1" SIZE="40">&nbsp &nbsp
            </td>
            </tr>

            </form>[/PHP]

            what should i put for the action? page A or page B
            because the verification in in page A

            and i have the uploading funciton in page B...

            if i put the action as pageA.. then is it
            [PHP]
            #
            if session("date") ="KAKAKA" then dteUserDate=ses sion("date") else dteUserDate=rsG et.field("date" )
            #
            if session("date2" )="KAKAKA" then dteUserDate2=se ssion("date2") else dteUserDate=rsG et.field("date2 ")
            #
            if session("date3" )="KAKAKA" then dteUserDate3=se ssion("date3") else dteUserDate=rsG et.field("date3 ")

            else <form action="pageB"> </form>

            [/PHP]

            i used to verify something in another page... but don knwo how to do it in a single page... pls help...

            Comment

            • danp129
              Recognized Expert Contributor
              • Jul 2006
              • 323

              #7
              Try somthing like this
              [CODE=asp]<%

              'Dim rsGet 'your recordset object
              'Dim cn 'your connection object
              'Dim strCon 'your connection string
              'Dim strSQL 'your SQL query
              'sCon="your connection string"
              'set rsGet=CreateObj ect("adodb.reco rdset")
              'set cn=CreateObject ("adodb.connect ion")
              'cn.open strCon

              Dim dteUserDate1
              Dim dteUserDate2
              Dim dteUserDate3
              Dim errMsg

              if Request.Form("s ub")="" then
              'The form was not submitted so prepare to show the form
              'ie set any default values you want to show in the form

              'strSQL="SELECT whatever from whatever"
              'rsGet.Open strSQL, cn, 1, 1
              dteUserDate1=rs Get("date1")
              dteUserDate2=rs Get("date2")
              dteUserDate3=rs Get("date3")
              call ShowForm
              else
              'The form was submitted so validate data
              dteUserDate1=Re quest.Form("dat e1")
              dteUserDate2=Re quest.Form("dat e2")
              dteUserDate3=Re quest.Form("dat e3")

              if dteUserDate1 <> "what you want it to equal" then errMsg=errMsg & "<BR>Date1 is incorrect"
              if dteUserDate2 <> "what you want it to equal" then errMsg=errMsg & "<BR>Date2 is incorrect"
              if dteUserDate3 <> "what you want it to equal" then errMsg=errMsg & "<BR>Date3 is incorrect"

              if errMsg <> "" then
              'There was an error of some type so show the form
              call ShowForm
              else
              'no errors with user submitted data

              'put your code here to update the database

              end if
              end if

              call cleanup
              'This is the end of the main code, the sub procedures below are called from above


              Sub Cleanup
              on error resume next
              'close recordset if open and remove reference
              rsGet.Close
              set rsGet=nothing
              'close db connection if open and remove reference
              cn.Close
              set cn=nothing
              end sub

              sub ShowForm

              if errMsg<>"" then Response.Write errMsg

              'If you don't specify an action, the form will post to the same page
              %>
              <form enctype="multip art/form-data" method="post">
              <table>
              <tr>
              <td><input type="textbox" name="date1" value="<%=dteUs erDate%>"></td>
              <td><input type="textbox" name="date2" value="<%=dteUs erDate2%>"></td>
              <td><input type="textbox" name="date3" value="<%=dteUs erDate3%>"></td>
              </tr>
              <tr>
              <td>&nbsp&nbs p</td>
              <td width="100"><FO NT FACE="Arial" SIZE="2" COLOR="#000000" ><B>Upload Image</font></td>
              <TD BGCOLOR="#EEEEE E">

              <INPUT TYPE="file" NAME="myFile" name="file1" SIZE="40">&nbsp &nbsp
              </td>
              </tr>
              <tr>
              <!--PS NEVER use "submit" as the NAME of a submit button!-->
              <input type=submit name=sub value="Submit">
              </tr>
              </table>
              </form>
              <%
              end sub
              %>[/CODE]

              Comment

              • lyealain
                New Member
                • May 2007
                • 102

                #8
                [PHP]if request.form("S AVE")="AA" THEN

                if request.form("p lan3")="" then
                msg="yoo"
                else
                response.redire ct("login.asp" )
                end if
                end if [/PHP]
                i test a textbox in a form...
                after submit..if left blank.. show yoo..
                else go to login.asp..

                but why it give error on
                Microsoft VBScript runtime error '800a01a8'

                Object required: 'response'

                error at the response.redire ct("Login.asp" )

                why arr??

                Comment

                • markrawlingson
                  Recognized Expert Contributor
                  • Aug 2007
                  • 346

                  #9
                  Drop the parantheses ( )

                  Response.Redire ct "login.asp"

                  Comment

                  Working...