Cannot grab some of the values from a form

Discussion in 'ASP General' started by Jack, Mar 30, 2005.

  1. Jack

    Jack Guest

    Hi, I got a simple form where one needs to input data. The data
    is being processed in an asp page.
    However, I cannot figure out why couple of values I am typing in the form
    is not being retrived in the asp processing page. Instead it shows as a null
    value.

    Any help is appreciated. I have attached the major code for the form, the
    processing page
    and output on the screen including sql output.
    Any help is appreciated. Regards.

    FORM CODE:

    <TABLE border = 0 width= "80%" >
    <TR>
    <TD>
    <INPUT id=chk_0
    name = chk_0
    type = hidden>
    <B><Font size = 2 color=darkblue>Add</font></B>
    </TD>
    <TD>
    <INPUT type = "text" size = 12
    value = ""
    name = "ID_0"
    style = "FONT-SIZE: 10">
    </TD>
    <TD>
    <INPUT type = "text" size = 12
    value = ""
    name = "date_0"
    style = "FONT-SIZE: 10">
    </TD>
    <TD>
    <INPUT type = "text" size = 12
    value = ""
    name = "contractedserviceexpense_0"
    style = "FONT-SIZE: 10">
    </TD>
    <TD>
    <INPUT type = "text" size = 12
    value = ""
    name ="travelexpense_0"
    style = "FONT-SIZE: 10">
    </TD>
    <TD>
    <INPUT type = "text" size = 12
    value = ""
    name = "personnelexpense_0"
    style = "FONT-SIZE: 10">
    </TD>
    </TR>
    </table>


    PROCESSING CODE:

    l_ENO = Request.Form("ID_0")

    Response.Write l_ENO & "<br>"


    l_Date = Request.Form("date_0")

    Response.Write l_Date & "<br>"




    l_ContracedServiceExpense =
    Request.Form("contractedserviceexpense_0")

    Response.Write l_contractedserviceexpense


    l_TravelExpense = Request.Form("travelexpense_0")

    Response.Write l_travelexpense & "<br>"


    l_PersonnelExpense = Request.Form("personnelexpense_0")

    Response.Write l_personnel & "<br>"

    'Create the UPDATE SQL STATEMENT

    sql = " INSERT INTO tblExpense (ENO, Date,
    ContractedServiceExpense, "
    sql = sql & "TravelExpense, PersonnelExpense)"
    sql = sql & " VALUES('" & l_ENO & "' , '" & l_Date & "', '" &
    l_contractedserviceexpense & "', '" & l_travelexpense & "', '" &
    personnelexpense & "')"
    Response.Write sql & "<BR>"


    OUTPUT FROM THE PROCESSED ASP PAGE

    1


    03/29/2005


    5




    INSERT INTO tblExpense (ENO, Date, ContractedServiceExpense, TravelExpense,
    PersonnelExpense) VALUES('1' , '03/29/2005', '', '5', '')
     
    Jack, Mar 30, 2005
    #1
    1. Advertisements

  2. Jack, again, you really need to use OPTION EXPLICIT at the top of your
    pages. Your variable names have typos. Option Explicit would have informed
    you of this immediately.

    l_ContracedServiceExpense = Request.Form("contractedserviceexpense_0")
    ^^^
    Response.Write l_contractedserviceexpense
    ^^^

    Also, you use "l_personnel" in one spot, but you are giving the form value
    to a variable named "l_PersonnelExpense."
    Option Explit would have alerted you to that as well.

    Ray at work



    "Jack" <> wrote in message
    news:...
    > Hi, I got a simple form where one needs to input data. The data
    > is being processed in an asp page.
    > However, I cannot figure out why couple of values I am typing in the form
    > is not being retrived in the asp processing page. Instead it shows as a

    null
    > value.
    >
    > Any help is appreciated. I have attached the major code for the form, the
    > processing page
    > and output on the screen including sql output.
    > Any help is appreciated. Regards.
    >
    > FORM CODE:
    >
    > <TABLE border = 0 width= "80%" >
    > <TR>
    > <TD>
    > <INPUT id=chk_0
    > name = chk_0
    > type = hidden>
    > <B><Font size = 2 color=darkblue>Add</font></B>
    > </TD>
    > <TD>
    > <INPUT type = "text" size = 12
    > value = ""
    > name = "ID_0"
    > style = "FONT-SIZE: 10">
    > </TD>
    > <TD>
    > <INPUT type = "text" size = 12
    > value = ""
    > name = "date_0"
    > style = "FONT-SIZE: 10">
    > </TD>
    > <TD>
    > <INPUT type = "text" size = 12
    > value = ""
    > name = "contractedserviceexpense_0"
    > style = "FONT-SIZE: 10">
    > </TD>
    > <TD>
    > <INPUT type = "text" size = 12
    > value = ""
    > name ="travelexpense_0"
    > style = "FONT-SIZE: 10">
    > </TD>
    > <TD>
    > <INPUT type = "text" size = 12
    > value = ""
    > name = "personnelexpense_0"
    > style = "FONT-SIZE: 10">
    > </TD>
    > </TR>
    > </table>
    >
    >
    > PROCESSING CODE:
    >
    > l_ENO = Request.Form("ID_0")
    >
    > Response.Write l_ENO & "<br>"
    >
    >
    > l_Date = Request.Form("date_0")
    >
    > Response.Write l_Date & "<br>"
    >
    >
    >
    >
    > l_ContracedServiceExpense =
    > Request.Form("contractedserviceexpense_0")
    >
    > Response.Write l_contractedserviceexpense
    >
    >
    > l_TravelExpense = Request.Form("travelexpense_0")
    >
    > Response.Write l_travelexpense & "<br>"
    >
    >
    > l_PersonnelExpense = Request.Form("personnelexpense_0")
    >
    > Response.Write l_personnel & "<br>"
    >
    > 'Create the UPDATE SQL STATEMENT
    >
    > sql = " INSERT INTO tblExpense (ENO, Date,
    > ContractedServiceExpense, "
    > sql = sql & "TravelExpense, PersonnelExpense)"
    > sql = sql & " VALUES('" & l_ENO & "' , '" & l_Date & "', '" &
    > l_contractedserviceexpense & "', '" & l_travelexpense & "', '" &
    > personnelexpense & "')"
    > Response.Write sql & "<BR>"
    >
    >
    > OUTPUT FROM THE PROCESSED ASP PAGE
    >
    > 1
    >
    >
    > 03/29/2005
    >
    >
    > 5
    >
    >
    >
    >
    > INSERT INTO tblExpense (ENO, Date, ContractedServiceExpense,

    TravelExpense,
    > PersonnelExpense) VALUES('1' , '03/29/2005', '', '5', '')
     
    Ray Costanzo [MVP], Mar 30, 2005
    #2
    1. Advertisements

  3. Jack

    Jack Guest

    Thanks Ray for pointing that out. My bad habits are getting better of my
    intentions. Next time probably, I will not end up with the same kind of
    'silly' mistake.
    Regards.

    "Ray Costanzo [MVP]" wrote:

    > Jack, again, you really need to use OPTION EXPLICIT at the top of your
    > pages. Your variable names have typos. Option Explicit would have informed
    > you of this immediately.
    >
    > l_ContracedServiceExpense = Request.Form("contractedserviceexpense_0")
    > ^^^
    > Response.Write l_contractedserviceexpense
    > ^^^
    >
    > Also, you use "l_personnel" in one spot, but you are giving the form value
    > to a variable named "l_PersonnelExpense."
    > Option Explit would have alerted you to that as well.
    >
    > Ray at work
    >
    >
    >
    > "Jack" <> wrote in message
    > news:...
    > > Hi, I got a simple form where one needs to input data. The data
    > > is being processed in an asp page.
    > > However, I cannot figure out why couple of values I am typing in the form
    > > is not being retrived in the asp processing page. Instead it shows as a

    > null
    > > value.
    > >
    > > Any help is appreciated. I have attached the major code for the form, the
    > > processing page
    > > and output on the screen including sql output.
    > > Any help is appreciated. Regards.
    > >
    > > FORM CODE:
    > >
    > > <TABLE border = 0 width= "80%" >
    > > <TR>
    > > <TD>
    > > <INPUT id=chk_0
    > > name = chk_0
    > > type = hidden>
    > > <B><Font size = 2 color=darkblue>Add</font></B>
    > > </TD>
    > > <TD>
    > > <INPUT type = "text" size = 12
    > > value = ""
    > > name = "ID_0"
    > > style = "FONT-SIZE: 10">
    > > </TD>
    > > <TD>
    > > <INPUT type = "text" size = 12
    > > value = ""
    > > name = "date_0"
    > > style = "FONT-SIZE: 10">
    > > </TD>
    > > <TD>
    > > <INPUT type = "text" size = 12
    > > value = ""
    > > name = "contractedserviceexpense_0"
    > > style = "FONT-SIZE: 10">
    > > </TD>
    > > <TD>
    > > <INPUT type = "text" size = 12
    > > value = ""
    > > name ="travelexpense_0"
    > > style = "FONT-SIZE: 10">
    > > </TD>
    > > <TD>
    > > <INPUT type = "text" size = 12
    > > value = ""
    > > name = "personnelexpense_0"
    > > style = "FONT-SIZE: 10">
    > > </TD>
    > > </TR>
    > > </table>
    > >
    > >
    > > PROCESSING CODE:
    > >
    > > l_ENO = Request.Form("ID_0")
    > >
    > > Response.Write l_ENO & "<br>"
    > >
    > >
    > > l_Date = Request.Form("date_0")
    > >
    > > Response.Write l_Date & "<br>"
    > >
    > >
    > >
    > >
    > > l_ContracedServiceExpense =
    > > Request.Form("contractedserviceexpense_0")
    > >
    > > Response.Write l_contractedserviceexpense
    > >
    > >
    > > l_TravelExpense = Request.Form("travelexpense_0")
    > >
    > > Response.Write l_travelexpense & "<br>"
    > >
    > >
    > > l_PersonnelExpense = Request.Form("personnelexpense_0")
    > >
    > > Response.Write l_personnel & "<br>"
    > >
    > > 'Create the UPDATE SQL STATEMENT
    > >
    > > sql = " INSERT INTO tblExpense (ENO, Date,
    > > ContractedServiceExpense, "
    > > sql = sql & "TravelExpense, PersonnelExpense)"
    > > sql = sql & " VALUES('" & l_ENO & "' , '" & l_Date & "', '" &
    > > l_contractedserviceexpense & "', '" & l_travelexpense & "', '" &
    > > personnelexpense & "')"
    > > Response.Write sql & "<BR>"
    > >
    > >
    > > OUTPUT FROM THE PROCESSED ASP PAGE
    > >
    > > 1
    > >
    > >
    > > 03/29/2005
    > >
    > >
    > > 5
    > >
    > >
    > >
    > >
    > > INSERT INTO tblExpense (ENO, Date, ContractedServiceExpense,

    > TravelExpense,
    > > PersonnelExpense) VALUES('1' , '03/29/2005', '', '5', '')

    >
    >
    >
     
    Jack, Mar 30, 2005
    #3
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Piers Chivers
    Replies:
    2
    Views:
    552
    Piers Chivers
    Mar 2, 2004
  2. dwelden
    Replies:
    11
    Views:
    601
    Neil Cerutti
    Jan 4, 2007
  3. Eric Layman
    Replies:
    4
    Views:
    604
    Eric Layman
    Mar 28, 2007
  4. Kelly

    Grab a User's Logon name in ASP.NET form?

    Kelly, Mar 10, 2005, in forum: ASP .Net Web Controls
    Replies:
    4
    Views:
    292
    Kelly
    Mar 15, 2005
  5. c676228
    Replies:
    4
    Views:
    480
    Adrienne Boswell
    Mar 17, 2008
  6. LaughOutLoud
    Replies:
    1
    Views:
    168
    Randy Webb
    Sep 28, 2006
  7. Tamer Higazi
    Replies:
    0
    Views:
    144
    Tamer Higazi
    Dec 11, 2013
  8. Tamer Higazi
    Replies:
    10
    Views:
    230
    Ian Kelly
    Dec 12, 2013
Loading...