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

Please Help!! Almost to Home Base with ASP.

Status
Not open for further replies.

BLBurden

Technical User
Jan 25, 2003
236
US
Hello All, first let me thank all of you for helping me through out the year from Access to ASP.
Merry Christmas and Happy New Year all.

I have been using FP2002 and using ASP for a couple of months now and I can't believe I have learn as much as I have, but it would not have been possible without you guys.

I am at 3rd base and ready to steal home plate. This is what I have learn:
1. How to create a ASP page and pass the data from ASP to Access database. (2). How to make my own confirmation page with CDONTS and email my ASP.

And I realize that the form I am using to send data to Access, where action= WEB-BOT, will not work. And I therefore cannot use CDONTS to send that page.

But what I want to do is - in my Confirmation page - learn how pass some of the fields value from the original ASP to the confirmation page. I have tried but with no avial.

I been reading about Response.write, Reponse.Redirect, but have not made anything work.

Some Original ASP form fields.
Site:
Incident #:
Call Type:
Description:....

To be sent to confirmation page. I know this is possible, but I havn't been able to do it.

I again solicit you help - and as always very much appreciated.


BLB[elephant2] - Always Grateful
A good friend will bail you out of jail. A true friend will be sitting at your side saying, "Boy - didn't we have fun?"
 
Experiment with this:
Page1.asp - the form page.
Code:
<html><head></head><body>
<form name="myform" method="post" action="page2.asp">
  <table width="400" border="0" cellspacing="0" cellpadding="2">
    <tr> 
      <td>First Name:</td>
      <td><input name="txtFName" type="text"></td>
      <td>Last name:</td>
      <td><input name="txtLName" type="text"></td>
    </tr>
    <tr> 
      <td>Email:</td>
      <td><input name="txtEmail" type="text"></td>
      <td>Site:</td>
      <td><input name="txtSite" type="text"></td>
    </tr>
    <tr> 
      <td>Incident#:</td>
      <td><input name="txtIncident" type="text"></td>
      <td>Call Type</td>
      <td><input name="txtCallType" type="text"></td>
    </tr>
    <tr> 
      <td>Description</td>
      <td colspan="3"><textarea name="txtDescription" ></textarea></td>
    </tr>
    <tr> 
      <td colspan="4" align="center"><input type="submit" name="Submit" value="Submit"></td>
    </tr>
  </table>
</form></body></html>
Page2.asp - the confirmation page.
Code:
<%
fName = request.Form("txtFName")
lName = request.Form("txtLName")
Email = request.Form("txtEmail")
IncidentNum = request.Form("txtIncident")
Site = request.Form("txtSite")
CallType = request.Form("txtCallType")
Description = request.Form("txtDescription")
myBody = "Thank you " & fName & " " & lName & " for whatever." & vbcrlf
myBody = myBody & "Incident#: " & IncidentNum & vbcrlf & "Site: " & Site & vbcrlf
myBody = myBody & "Call Type: " & CallType & vbcrlf & "Description: " & Description 
SET myMail = Server.CreateObject("CDONTS.NewMail")
With myMail
	.To = Email
	.From = "yourEmailAddress"
        .CC = "yourEmailAddress"
	.Subject = "Email Confirmation"
	.Body = myBody
	.Send 
End With
SET myMail = nothing
%>
<html><head><title>Confirmation</title></head><body>
Your email has been sent!<br>
<%=Replace(myBody,vbcrlf,"<br>")%>
</body></html>
It's written on the fly and untested (should work though) and there is no validation to make sure all form fields are filled in. You will need to replace "yourEmailAddress" on Page2.asp with a valid email address.
Happy coding!
 
When you write "sent" to another page, what do you mean? Do you mean that if the user clicks something then the user is sent to that page and that page gets some data? Meaning there's no form on the first page?

If so, then there are two basic ways to do it: via a form or via the querystring.

First a form. Here's a sample form on the first page, where the user only sees a button that says "Go to Next Page".
Code:
<form name="MyForm" action="TheNewPage.asp" method="POST">
    <input type="hidden" name="site" value="whatever">
    <input type="hidden" name="incident" value="whatever">
    <input type="hidden" name="calltype" value="whatever">
    <input type="hidden" name="description" value="whatever">
    <input type="submit" value="Go to Next Page" name="Go">
</form>
Then on the next page (TheNewPage.asp in this example), you'd retrieve the values like this:
Code:
<%
strSite = Request.Form("site")
strIncident = Request.Form("incident")
strCallType = Request.Form("calltype")
strDescription = Request.Form("description")
%>
If, on the other hand, you want to do it with a regualar clickable link, your first page's like would look something like this:
Code:
<a href="TheNewPage.asp?site=whatever&incident=whatever&calltype=whatever&description=whatever>Go to Next Page</a>
and you'd retrieve the values on the next page like this:
Code:
<%
strSite = Request.QueryString("site")
strIncident = Request.QueryString("incident")
strCallType = Request.QueryString("calltype")
strDescription = Request.QueryString("description")
%>
Of course, having typed all that, you probably mean something else. Hopefully it's helpful anyway.

The ASP tutorial at covers all this well.
 
Thank you guys so very much for responding so fast. I am not very good at explaining my self since I know little of nothing about ASP.

What I was trying to say Genimuse, is tha I have a form call Index3.asp with a SUBMIT and a RESET Button at the bottom. When the user fill in the form it submits the data to the Access DB and then I want it to pass some of the selected data fields into my confirmation page.

Hope I have explain that better: I will try both of the above mention codes and let you know. Thanks bunches

BLB[elephant2] - Always Grateful
A good friend will bail you out of jail. A true friend will be sitting at your side saying, &quot;Boy - didn't we have fun?&quot;
 
Just take 10 minutes with the ASP tutorial: it will show you exactly how to pass data from a form to another page, and how to deal with it.
 
Well thank you guys any way for trying to help me but still with no avial, I will continue my quest on trying to figure this out.

They way you gave me do work for pages that not driven by Web bot by my page is because I do need to input my asp into a database. But never-the-less have a wonderful holiday.

BLB[elephant2] - Always Grateful
A good friend will bail you out of jail. A true friend will be sitting at your side saying, &quot;Boy - didn't we have fun?&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top