Link to home
Start Free TrialLog in
Avatar of nikora1
nikora1

asked on

How to make ASP redirect to an HTML page

I have an ASP page that Inserts data into an MS Access database. After the data has been successfully entered it uses the following ASP code to give a successfull response.

Response.Write "Congratulations E Hoa Ma you have successfully registered with Nga Hapu O Nga Ruahine Iwi. click on the back button to return to the website !"

How do i make the ASP page redirect to an HTML page after successfully entering the data.
Avatar of HuyBD
HuyBD
Flag of Viet Nam image

You can you response.redirect("...") , in your case, try that

Response.Write "Congratulations E Hoa Ma you have successfully registered with Nga Hapu O Nga Ruahine Iwi. click on the back button to return to the website !"
Response.Write "<input type=""button"" value=""return"" onclick=""windows.location.href=""yourpage"""">"
ASKER CERTIFIED SOLUTION
Avatar of Emad Gawai
Emad Gawai
Flag of United Arab Emirates image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of srini5474
srini5474

this eg would solve this question as well as your form validation question,

in this example i have written a code to vaildate the form and submit it if required fields are filled in. Once the required fileds as sucessfully filled in the form submits and directs you to DBinsert.asp page in which you can write code to insert into DB and gives a congartulation message followed by a button which will direct you to your home page.

<%@ language="javascript" %>
<html>
<head>
    <title>Untitled Page</title>
</head>
<script language="javascript">
function doSubmit(form)
{  
    if (IsEmpty(form.Topic.value)) {
        alert("Session Topic is a required field.");
        return(false);
      }
     return true;
}
function IsEmpty(str)
{
      return (str.length == 0);
}
</script>
<BODY>
<FORM ID="NewSchedule" NAME="NewSchedule" METHOD="POST" action="DBinsert.asp"
                  onsubmit="return doSubmit(this);">
<input type="text" name="Topic" />
<input type="submit" value="submit" />
</FORM>
</BODY>
</html>

// code for DBinsert.asp page

<%@ language="javascript" %>
<%
    // code your DB operations
    Response.Write("Congratulations E Hoa Ma you have successfully registered with Nga Hapu O Nga Ruahine Iwi. click on the back button to return to the website !");
    Response.Write ("<input type='button' value='return' onclick=window.location.href='home.htm'>");
   
%>

Hope this helps :)