ASP / Redirect

S

SyrUser03

I am new to ASP, still learning.

I have a page that has a submit button.

<form action="move.asp" method="GET">
<input type="submit" value="Query">

The form is sending values to the move.asp page. Which will in turn be
inserted into a database. My questions is can I do the insert without
having to go/see the another page.

For example.
I click on the submit button, it adds the record and then goes back to the
original page.

Thanks in advance
 
R

Roji. P. Thomas

Ofcourse, you can post back to the same page,

Here is the psudo code for you.
<%
If Request.Form("Someformfield") <> "" Then --Poor mans IsPostback() ;)
' Save record
End If

Render your page here

%>
 
M

McKirahan

Roji. P. Thomas said:
Ofcourse, you can post back to the same page,

Here is the psudo code for you.
<%
If Request.Form("Someformfield") <> "" Then --Poor mans IsPostback() ;)
' Save record
End If

Render your page here

%>

However, since the OP uses "GET", it would be:

<%
If Request.QueryString() <> "" Then
' Save record
End If

' Render your page here

%>
 
R

Roland Hall

in message : : > Ofcourse, you can post back to the same page,
: >
: > Here is the psudo code for you.
: > <%
: > If Request.Form("Someformfield") <> "" Then --Poor mans IsPostback() ;)
: > ' Save record
: > End If
: >
: > Render your page here
: >
: > %>
: >
: >
: >
: > --
: > Roji. P. Thomas
: > Net Asset Management
: > https://www.netassetmanagement.com
: >
: >
: > : > >I am new to ASP, still learning.
: > >
: > > I have a page that has a submit button.
: > >
: > > <form action="move.asp" method="GET">
: > > <input type="submit" value="Query">
: > >
: > > The form is sending values to the move.asp page. Which will in turn
be
: > > inserted into a database. My questions is can I do the insert without
: > > having to go/see the another page.
: > >
: > > For example.
: > > I click on the submit button, it adds the record and then goes back to
: the
: > > original page.
: > >
: > > Thanks in advance
:
: However, since the OP uses "GET", it would be:
:
: <%
: If Request.QueryString() <> "" Then
: ' Save record
: End If
:
: ' Render your page here
:
: %>

I thought for QueryString is was preferable to use:
<%
if len(request.queryString) <> 0 then
'Save record
end if

' Render your page here
%>

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
 
R

Roji. P. Thomas

I dont think that approach is safe because
len(request.queryString) can be greater than zero even when the page
is not post backed.
 
I

Iain Norman

I am new to ASP, still learning.

I have a page that has a submit button.

<form action="move.asp" method="GET">
<input type="submit" value="Query">

The form is sending values to the move.asp page. Which will in turn be
inserted into a database. My questions is can I do the insert without
having to go/see the another page.

For example.
I click on the submit button, it adds the record and then goes back to the
original page.

Thanks in advance
Send the values to the move.asp page, have it do what it needs to do
then if everything is okay finish the move.asp page with a
response.redirect to the original page.

eg. Response.Redirect("form.asp")

You don't even need any html in the move.asp page, unless you want to
report an error.


I
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,159
Messages
2,570,879
Members
47,417
Latest member
DarrenGaun

Latest Threads

Top