chuffer123
Posts: 3
|
Posted: 01/12/2005, 12:00 PM |
|
There is probably a very simple solution for this; I just can't figure it out.
After a user fills out and Adds or Submits data in a form, I would like to direct him or her to a new page which confirms what they did (e.g. "thanks for registering ...").
I would like to be able to include at least 1 or 2 data fields from the form they just completed; how do I get values (e.g. Name) from one page to another?
Thanks!
|
|
|
peterr
Posts: 5971
|
Posted: 01/12/2005, 1:05 PM |
|
You can create a record form on the 2nd (confirmation) page that displays the data entered on the 1st page. Just use labels instead of textboxes on that 2nd page.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
|
|
chuffer123
Posts: 3
|
Posted: 01/12/2005, 1:32 PM |
|
Thanks for the start, Peter:
1. I added a new Form to the Confirmation Page I had already created
2. I set up the Connection to my database, & selected the table as my data source
3. I set Allow Insert, Update & Delete as "No"
4. for each of the 2 labels, I set Control Source type to Database column, and Control Source to the field in the table I want
After publishing the page and running it in my browser, I got the 2 labels; but for the 1st record in the table, not for the record I had just inserted.
I am guessing that in the form's data source I need to set up a WHERE statement? I tried WHERE RefKey = {RefKey} (RefKey is the key field in the table I am using); republished; and re-ran the page. Now the labels are blank.
Please help! Thanks!
|
|
|
peterr
Posts: 5971
|
Posted: 01/12/2005, 1:47 PM |
|
Oops, I forgot that you will need to pass the key to the new page.
Take a look at "Multi-Step User Registration" example in CCS Example Pack. The 1st page ( http://examples.codecharge.com/ExamplePack/MultiStepReg...gistration1.php) is used for the data entry, while the 2nd page ( http://examples.codecharge.com/ExamplePack/MultiStepReg...2.php?user_id=3) displays the same record again with additional fields. The 1st page has an event that retrieves the previously created record id.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
|
|
chuffer123
Posts: 3
|
Posted: 01/12/2005, 4:04 PM |
|
I think that I have most of the code figured out, Peter: you basically are looking up the key field in the database table, based on the value of 1 field submitted with the form. The value of this key field is then used to create a parameter string which is added to the destination page URL.
My problem is, I do not have a unique field which is being submitted via the form (in your example, user_login is a unique field). Is it possible to combine several fields in the CCDLookup function to create a unique value (e.g. FirstName+LastName+ZipCode)? If yes, what would be the proper syntax for the WHERE portion of the CCDLookup function? Or would it be easier to create & define a temporary variable = FirstName+LastName+ZipCode and use that variable in the function?
|
|
|
Chuck
|
Posted: 01/13/2005, 4:03 PM |
|
After a bit of playing around, I did figure out that it is possible to combine multiple fields when searching for a record key to pass to a confirmation page (modification of the event created in the Multi-Step User Registration:
Dim LastID
Dim WhereString
'Retrieve the last inserted key if a new user is registered
'This method of retrieving the last inserted key is safe because the value of the user_login field has to be unique.
WhereString = "RefFName="&DBPOG2005.ToSQL(Request.Form("RefFName"),"CCText")&" AND RefLName="&DBPOG2005.ToSQL(Request.Form("RefLName"),"CCText")&" AND RefRegion="&DBPOG2005.ToSQL(Request.Form("RefRegion"),"CCText")
If IsEmpty(Request.QueryString("RefKey")) Then
LastID = CCDLookup("max(RefKey)","tblReferees",WhereString,DBPOG2005)
If InStr(Redirect,"?") = 0 Then
Redirect = Redirect & "?RefKey=" & LastID
ElseIf Right(Redirect, 1) = "?" Then
Redirect = Redirect & "RefKey=" & LastID
Else
Redirect = Redirect & "&RefKey=" & LastID
End If
End IF
I chose to define a string variable WhereString just to make the CCDLookup a bit more manageable.
|
|
|
|