Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

request.form("x") not actually giving a value. 1

Status
Not open for further replies.

DocGrimm

Programmer
Mar 16, 2004
8
US
I think the following code speaks for itself, but basically, when trying to put a value from a form into a variable, I'm getting nothing to come through.

I'm new to any sort of web coding, so any help is greatly appreciated:

Code:
<%
// Assign Variables

hdnDate=request.form("hdnDate")
%>

<html>
<title>Detail Entry Page</title>

<BODY>

	<form name="dentry" action=<%= request.servervariables("script_name") %> METHOD="POST">
	
		<!-- HIDDEN ENTRIES -->
		<INPUT Type="text" NAME="hdnDate" value="1">
		
		<p align="center"><b><font face="Arial">

		<!-- Works -->
		Detailed Entry for <%=Response.Write("hdnDate")%>
		<br>
		<!-- Does not Work -->
		Detailed Entry for <%=Response.Write(hdnDate)%>

		</font></b></p>

</body>
</html>
 
For starters, this HTML is banged up - there is no HEAD .. HEAD section - and TITLE should be in there. FORM has no /FORMN and action is not wrapped in quotes.

And value should be there after you submit the form.

------
"There's a man... He's bald and wears a short-sleeved shirt, and somehow he's very important to me. I think his name is Homer."
(Jack O'Neill, Stargate)
[banghead]
 
<!-- Does not Work -->
Detailed Entry for <%=Response.Write(hdnDate)%>

you missed quotes...

-DNG
 
not he didnt miss quotes as he sets the hdnDate to request.form("hdnDate")

Actually works fine for me but try this
Code:
<%
// Assign Variables

hdnDate=request.form("hdnDate")
%>

<html>
<title>Detail Entry Page</title>

<BODY>

    <form name="dentry" action=<%= request.servervariables("script_name") %> METHOD="POST">
    
        <!-- HIDDEN ENTRIES -->
        <INPUT Type="text" NAME="hdnDate" value="1">
        
        <p align="center"><b><font face="Arial">

        <!-- Works -->
        Detailed Entry for <%=Response.Write("hdnDate")%>
        <br>
        <!-- Does not Work -->
        Detailed Entry for <%=Response.Write(hdnDate)%>

        </font></b></p>
		<input name="" type="submit" value="submit">
		</form>

</body>
</html>

}...the bane of my life!
 
also DocGrimm

<%= is equivalent to Response.Write...

so you can just say

<%=hdnDate%>

or
<%
Response.Write hdnDate
%>

-DNG
 
Thanks to you too, DotNetGnat,

I know I've got a lot to learn about this yet. I'm sure I'll be back.

Any suggestions on a crash corse for ASP? or Web Development in general? I'm trying to cut down a page's average load time from 3 minutes to something realistic. And being new to ASP, working with someone else's code, etc... any help is appreciated.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top