Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Javascript not Carrying Over To Order Page
Old 02-04-2010, 04:04 AM Javascript not Carrying Over To Order Page
Super Talker

Posts: 104
Location: Northern Ireland
Trades: 0
Hi

This is hopefully the second last problem I will have with this site that Im building . The last problem will be trying to integrate the Javascript final value (in £) with the server side CGI script of the payment processor. I know I will hav a difficult time with that!

Anyway, I have built a very basic test HTML and Javascript shopping cart - but the values from one page (when a radio button is clicked) will NOT carry over to the final page (order confirm) for some strange and unknown reason. Is it the case I need the Javascript writing from EACH page to a hidden CGI page / script (server side) to "remember" the information selected on the first page? Or does Javascript do this for you?

The order form starts here http://www.approvedcv.co.uk/order.html and spreads over 4 pages to get to the next page please ignore the blue button link at the bottom of the page and use the orange links saying "On To Next Step!" at the right hand side (for now - I cant figuire out how to change the links here but Im working on it) .
sebastianx is offline
Reply With Quote
View Public Profile Visit sebastianx's homepage!
 
 
Register now for full access!
Old 02-04-2010, 05:18 AM Re: Javascript not Carrying Over To Order Page
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
Quote:
Is it the case I need the Javascript writing from EACH page to a hidden CGI page / script (server side) to "remember" the information selected on the first page? Or does Javascript do this for you?
No, you have to take every steps to memorize the value at each steps.
The web is created on a "fire and forget" model.
It's not an application that starts, run, and then die. Each pages start, run and dies.
So, the javascript present in one page has no idea what was done previously.
Which means that you have to use the server side to track what informations are important to you, and to give them each time to each javascript in each pages you would need this information.

In your case, it means that you must carry each value from each pages to the next.

I usually use the PHP session mechanism for that.
1 page is presented to the user, he does something in it.
When he submit it, I store the values in $_SESSION and redirect to the next page.

From that other page, I fetch the values from $_SESSION, display the form.
The user makes his choices, submit this page, and I store again the new informations in the session.

When I hit the final page, I (should) have everything needed in the session, and once the checkout is done, clear them to avoid a "back" button hit to relaunch the order.
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Old 02-04-2010, 05:18 AM Re: Javascript not Carrying Over To Order Page
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,383
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Quote:
Is it the case I need the Javascript writing from EACH page to a hidden CGI page / script (server side) to "remember" the information selected on the first page?
No you will have to SUBMIT the information each time to the server and store it in session variables or cookies.

Quote:
Or does Javascript do this for you?
Nope. Or rather only if you save it to a cookie and read it back.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to Javascript not Carrying Over To Order Page
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.46065 seconds with 12 queries