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 problem

Status
Not open for further replies.

NEveritt

MIS
Dec 30, 2002
25
GB
I think I am going mad here, so if someone can help me out:

Im new to .ASP and I am adding an IF statement to the submit button to Insert a new record if it is clicked. I have tried this both submitting to the same page and to another page, and I have tried Get & Post

so I have the button:

<input type="submit" value="Add" name="view">

then the IFwhich is:

<%
if request.form("view") = "Add" then
(running insert code, which I have checked works)
end if
%>

I have played with it, and basically proven that Submit button is not returning the value of the button.

So i havent a clue whats happening.

Other info:

IF statement is within the form, after the Submit button, but I have tried it all over the place. - SHOULD IT GO SOMEWHERE INPARTICULAR?

 
the code should look something like this:
Code:
<html>
<body>
<form>
'all form fields
</form>
<%
if request.form("view") = "Add" then
(running insert code, which I have checked works)
end if
%>
</body>
</html>

-DNG
 
Not sure what you're doing...

Code:
<form name=myForm action=pe3.asp method=post>
<input type=submit value="add" name="view">
<input type=submit value="update" name="view">
</form>

Code:
<%
 response.write request("view")
%>

works fine. Can you post some code?

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook
 
hmm, again unless Im going mad its all ok, so I have posted the code here:

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 4</title>
</head>


<body>

<form method="get" action="updatereceive.asp">

<p><select size="1" name="campaignname">


<option> LOOPING A RECORDSET IN HERE</option>

</select>
<input type="submit" value="Add" name="View"></p>



</form>

<%
if request.form("View") = "Add" then
INSERT GOES HERE
end if
%>
<%objNAME.close
set objNAME = nothing
%>

</body>

</html>
 
Are you posting to the page that holds your form or is the page calling itself? You might be able to see what's up be using

response.write "XX" & request.form("View") & "XX"

or something...

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook
 
since you have used GET method...try

if request.querystring("View") = "Add" then

-DNG
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top