PDA

View Full Version : server.transfer


pankaj
03-14-2003, 04:15 AM
I have written a code which looks like this. the name of the page is gateName.asp

<%
if Trim(request("txtName")) = "" Then
%>
<html>
<body>
<form name="frmName" action="gateName.asp">
<input type="text" name="txtName">
<input type="submit" >
</form>
</body>
</html>
<%
else
''' 'code for entering the data in the database
server.Transfer "gateName.asp"

End if
%>


once the page is submitted i want to show the same page again because the user may want enter a different name.

but if I use server.Transfer method the variables retain their values and the control goes in else part .

I do not want to use response.redirect.

david7777
03-14-2003, 06:44 AM
Rather try this:


<html>
<body>
<form name="frmName" action="gateName.asp">
<input type="text" name="txtName">
<input type="submit" >
</form>
<%
if not Trim(request("txtName")) = "" Then
' code for entering the data in the database

' Write success message (ie: "Name added successfully!")
End if
%>
</body>
</html>

Then the page will always show the form, but only update the database if there was a name entered...