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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Respond Success then Redirect

Status
Not open for further replies.

Webflex

Technical User
Apr 20, 2001
101
GB
Hi

The following adds to a database, how could I get it to display the message saying the record added succesfully and then redirect to some other page?

TIA
Webflex

Code:
<%
option explicit
dim useraction
dim dsn,sql,conn,rs
dim ProjectDescription,ClientID,LastName,orid,DateCreate,PM,TPLATE
useraction=request(&quot;action&quot;)
select case useraction
case &quot;add&quot;
	ProjectDescription=request.form(&quot;ProjectDescription&quot;)
	ProjectDescription=replace(ProjectDescription,&quot;'&quot;,&quot;''&quot;)
	ClientID=request.form(&quot;ClientID&quot;)
	ClientID=replace(ClientID,&quot;'&quot;,&quot;''&quot;)
	LastName=request.form(&quot;LastName&quot;)
	LastName=replace(LastName,&quot;'&quot;,&quot;''&quot;)
	orid=request.form(&quot;orid&quot;)
	DateCreate=request.form(&quot;DateCreate&quot;)
	DateCreate=replace(DateCreate,&quot;'&quot;,&quot;''&quot;)
	PM=request.form(&quot;PM&quot;)
	PM=replace(PM,&quot;'&quot;,&quot;''&quot;)
	TPLATE=request.form(&quot;TPLATE&quot;)
	TPLATE=replace(TPLATE,&quot;'&quot;,&quot;''&quot;)
	sql = &quot;insert into users (Clientid,ProjectDescription,LastName,orid,DateCreate,PM,TPLATE) values('&quot;&ClientID&&quot;','&quot;&ProjectDescription&&quot;','&quot;&LastName&&quot;','&quot;&orid&&quot;','&quot;&DateCreate&&quot;','&quot;&PM&&quot;','&quot;&TPLATE&&quot;')&quot;
	dsn=&quot;DBQ=&quot; & Server.Mappath(&quot;../db/csoprojects.mdb&quot;) & &quot;;Driver={Microsoft Access Driver (*.mdb)};&quot;
	set conn=server.createObject(&quot;adodb.connection&quot;)
	conn.open dsn
	conn.execute(sql)
	conn.close
	set conn = nothing
	response.write &quot;<b>Project added successfully - click View Last Project for Number</b> &quot;
end select%>
<%

Sub ShowUKdate()

dim dateStr, UKdate
dateStr=split(date,&quot;/&quot;)

'add leading zero to single figures

    if Len(dateStr(0))<2 then
        dateStr(0)=&quot;0&quot;&dateStr(0)
    end if

    if Len(dateStr(1))<2 then
        dateStr(1)=&quot;0&quot;&dateStr(1)
    end if

    if Int(dateStr(0))=month(now) then
        UKdate=dateStr(1)&&quot;/&quot;&dateStr(0)&&quot;/&quot;&dateStr(2)
    else
        UKdate=join(dateStr,&quot;/&quot;)
    end if

    response.write UKdate
    End Sub
%>
<html>
<head>

	<title>add</title>
</head>

<body bgcolor=&quot;#FFFFFF&quot;>
<table border=&quot;0&quot; width=&quot;558&quot; align=center><form name=&quot;addform&quot; action=&quot;add.asp?action=add&quot; method=&quot;post&quot;>
  <tr> 
    <td width=&quot;64&quot;><font size=&quot;1&quot; face=&quot;Verdana&quot;>Client</font></td>
    <td width=&quot;480&quot;><font size=&quot;1&quot; face=&quot;Verdana&quot;> 
      <!--webbot
          bot=&quot;Validation&quot; S-Data-Type=&quot;String&quot; B-Value-Required=&quot;TRUE&quot;
          I-Minimum-Length=&quot;1&quot; -->
      <input type=&quot;text&quot; name=&quot;ClientID&quot; size=&quot;20&quot;>
      </font></td>
  </tr>
  <tr> 
    <td width=&quot;64&quot;><font size=&quot;1&quot; face=&quot;Verdana&quot;>Client Contact</font></td>
    <td width=&quot;480&quot;><font size=&quot;1&quot; face=&quot;Verdana&quot;> 
      <!--webbot
          bot=&quot;Validation&quot; S-Data-Type=&quot;String&quot; B-Value-Required=&quot;TRUE&quot;
          I-Minimum-Length=&quot;1&quot; -->
      <input type=&quot;text&quot; name=&quot;LastName&quot; size=&quot;20&quot;>
      </font></td>
  </tr>
  <tr> 
    <td width=&quot;64&quot;><font face=&quot;Verdana, Arial, Helvetica, sans-serif&quot; size=&quot;1&quot;>Project 
      Manager</font></td>
    <td width=&quot;480&quot;><font size=&quot;1&quot; face=&quot;Verdana&quot;>
      <input type=&quot;text&quot; name=&quot;PM&quot; size=&quot;20&quot;>
      </font></td>
  </tr>
  <tr> 
    <td width=&quot;64&quot;><font face=&quot;Verdana, Arial, Helvetica, sans-serif&quot; size=&quot;1&quot;>Template</font></td>
    <td width=&quot;480&quot;><font size=&quot;1&quot; face=&quot;Verdana&quot;>
      <input type=&quot;text&quot; name=&quot;TPLATE&quot; size=&quot;20&quot;>
      </font></td>
  </tr>
  <tr> 
    <td width=&quot;64&quot;><font size=&quot;1&quot; face=&quot;Verdana&quot;>Project Description</font></td>
    <td width=&quot;480&quot;><font size=&quot;1&quot; face=&quot;Verdana&quot;> 
      <textarea rows=&quot;3&quot; name=&quot;ProjectDescription&quot; cols=&quot;50&quot;></textarea>
      </font></td>
  </tr>
  <tr> 
    <td width=&quot;64&quot;></td>
    <td width=&quot;480&quot;></td>
  </tr>
  <tr> 
    <td width=&quot;64&quot;><font size=&quot;1&quot; face=&quot;Verdana&quot;>Code</font></td>
    <td width=&quot;480&quot;><font size=&quot;1&quot; face=&quot;Verdana&quot;> 
      <select size=&quot;1&quot; name=&quot;orid&quot;>
        <option value=&quot;UK&quot;>UK</option>
        <option value=&quot;OR&quot;>OR</option>
        <option value=&quot;RS&quot;>RS</option>
        <option value=&quot;OE&quot;>OE</option>
        <option value=&quot;CO&quot;>CO</option>
        <option value=&quot;IT&quot;>IT</option>
        <option value=&quot;MM&quot;>MM</option>
        <option value=&quot;AP&quot;>AP</option>
        <option value=&quot;DU&quot;>DU</option>
        <option value=&quot;NC&quot;>NC</option>
        <option value=&quot;NR&quot;>NR</option>
        <option value=&quot;IS&quot;>IS</option>
        <option value=&quot;LT&quot;>LT</option>
        <option value=&quot;PI&quot;>PI</option>
        <option value=&quot;FM&quot;>FM</option>
        <option value=&quot;MI&quot;>MI</option>
        <option value=&quot;AI&quot;>AI</option>
        <option value=&quot;NE&quot;>NE</option>
        <option value=&quot;AS&quot;>AS</option>
        <option value=&quot;AC&quot;>AC</option>
        <option value=&quot;SE&quot;>SE</option>
        <option value=&quot;US&quot;>US</option>
        <option value=&quot;BZ&quot;>BZ</option>
        <option value=&quot;RA&quot;>RA</option>
        <option value=&quot;WE&quot;>WE</option>
      </select>
      <font color=&quot;#FF0000&quot;>The number component will be assigned once 'add' has 
      been pressed.</font></font></td>
  </tr>
  <tr> 
    <td width=&quot;64&quot;><font size=&quot;1&quot; face=&quot;Verdana&quot;>Date Created</font></td>
    <td width=&quot;480&quot;><font size=&quot;1&quot; face=&quot;Verdana&quot;> 
      <input type=&quot;text&quot; name=&quot;DateCreate&quot; size=&quot;10&quot; value=&quot;<% ShowUKdate %>&quot;>
      <font size=&quot;1&quot; face=&quot;Verdana&quot; color=&quot;#FF0000&quot;>(dd/mm/yy)</font></font></td>
  </tr>
  <tr> 
    <td colspan=&quot;2&quot; align=&quot;center&quot; width=&quot;550&quot;><font size=&quot;1&quot; face=&quot;Verdana&quot;>Add 
      new project</font>
  </tr>
  <tr> 
    <td colspan=&quot;2&quot; align=&quot;center&quot; width=&quot;550&quot;><font size=&quot;1&quot; face=&quot;Verdana&quot;> 
      <input type=&quot;submit&quot; value=&quot;add&quot; style=&quot;background-color: #000080; color: #FFFFFF; border-style: ridge; border-color: #000080&quot;>
      </font>
  </tr>
  <tr> 
    <td colspan=&quot;2&quot; align=&quot;center&quot; width=&quot;550&quot;> 
  </tr>
</table>
 
<%
response.redirect(&quot;Success!&quot; & vbcrlf)
response.redirect(&quot;<script>&quot; & vbcrlf)
response.redirect(&quot;window.location='redirectpage.asp'&quot; & vbcrlf)
response.redirect(&quot;</script>&quot; & vbcrlf)
 
Thanks, that or a derivative of it did the job.
 
Thanks, that or a derivative of it did the job.

Cheers
Webflex
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top