Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Cannot grab some of the values from a form
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', '')

Report this thread to moderator Post Follow-up to this message
Old Post
Jack
03-30-05 01:55 AM


Re: Cannot grab some of the values from a form
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" <Jack@discussions.microsoft.com> wrote in message
news:E752D530-6FFB-4548-A8D4-A6F9872A0472@microsoft.com...
> 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', '')



Report this thread to moderator Post Follow-up to this message
Old Post
Ray Costanzo [MVP]
03-30-05 08:55 PM


Re: Cannot grab some of the values from a form
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 inform
ed
> 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" <Jack@discussions.microsoft.com> wrote in message
> news:E752D530-6FFB-4548-A8D4-A6F9872A0472@microsoft.com... 
> null 
> TravelExpense, 
>
>
>

Report this thread to moderator Post Follow-up to this message
Old Post
Jack
03-31-05 01:55 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

ASP archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 06:49 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.