Click to See Complete Forum and Search --> : Need help with cookies


Lotz
08-28-2003, 07:07 AM
Hello,

I hope that someone could help me.

I visited many websites with tutorial about cookies, but I couldn't find what I'm looking for. :(

I have a form with the following fields: firstname, lastname, donation amount and email. When you click on the submit button, the form is sent (CGI with method=POST), a thank you page (thankyou.html) is displayed and I receive the info by email.

I would like to personalize the thank you page, like this:

Dear "firstname" "lastname",

Thanks you very much for you donation of "amount".
...

I would like that the firstname, lastname and donation amount are displayed on the thank you page, with the values submitted in the form.

I think the best should be to do it with cookies, as I don't have access to the script CGI.

The cookie should be deleted when the thank you page is closed.

I tried to have it works for few weeks now, but I couldn't.

It would be very kind if someone could help me.

Thanks a lot in advance.

Khalid Ali
08-28-2003, 07:53 AM
Problem is once you submit the form there is no way javascript can be activated for any actionafter that point.for a thank you page you will need to use server side.
In IE there is a built in delay before action attribute is executed which gives you some time to run some other script when a submit button is clicked,however its not reliable,because the results won't be consistent

Lotz
08-28-2003, 08:40 AM
I was thinking of doing it like that:

1) Page with the form: when someone enter his data and click on the submit button, a cookie is set and the data is sent via the CGI script to me by email.

2) The thank you page is displayed. The CGI script I'm using give the possibility to have the redirection to a thank you page (this is not a problem).

3) I would like that the thank you page read the cookie set in the previous page and displays the data on it, as explained I my previous post.

4) When the thank you page is closed, the cookie should be deleted.

It should be possible, shouldn't it?

Khalid Ali
08-28-2003, 08:56 AM
possible? of course it is,however,you will need to send the thank you page back from the CGI code

Lotz
08-28-2003, 09:05 AM
What do you mean exactly by:
you will need to send the thank you page back from the CGI code?
Could you explain it a little bit more?

Thanks

Khalid Ali
08-28-2003, 09:20 AM
well as I said in my first reponse,
1. submit the page content and write cookie .

2. your CGI app will create a dynamic page(thanks you page?)
3. This page be displayed inthe window that submitted the form.

The problem as I mentioned before is that once you click on submit button or submit event is triggered on a form it in turn triggers the action command in the form,and once action starts you have no control over the page contents,they go out of scope.

To generate a thank you pageon client side you need to have control on page(which you don't anymore)

Therefore once your data is eached at CGI it prepares the responce for the request.

Hope it made any sense for you.

Lotz
08-28-2003, 10:17 AM
The thank you page is not a dynamic page. It is a static HTML page (thankyou.html), that is uploaded on the server.
This page won't be created by the cgi script. It is just redirected to it.
The thank you page is created by me.
Then, I have a complete control on the page... I can put what I want on that page (images, javascript, etc.).

That's why I was thinking of reading the cookie set in the form and display the data on the thank you page.