Jump to content

Please Help Me Pass Data From Order Page to Confirmation Page?


JMareel
 Share

Recommended Posts

Hello everyone. I need some major help trying to complete and code my Confirmation page which needs to receive the data from the Order page. I have been trying to study code online especially here at w3schools which is a great site but to no avail :) Here is the scenario. I have a website that is ready to be published to the internet and hopefully make a difference in the community and at the same time make some side cash. The only problem is that the two important pages of this site are not completed yet. I have an Order page and a Confirmation page that needs to be completed. The user/customer clicks checkboxes on the items they would like in the Order page. Once they have checked all the boxes next to the items they want, they click SUBMIT which passes them to a Confirmation page. The Order page is complete and does what I would like it to do for now thanks to some help from another forum helper. My Confirmation page is what needs work because I have NO idea how to then pass the information from the Order page to the Confirmation page so it can list ONLY the items they checked, calculate and display the price based on the number of items they checked and then ask the user to check the method of payment and method of product delivery. Once they are 1) satisfied that the items listed on the top of the Confirmation page are correct, 2) have seen the price, 3) and checked the payment method and delivery option; they will click the SUBMIT button which would pass all that information from the Confirmation page to an email that goes to me. So basically it would look like this...Order page --> Confirmation page --> send email to me containing Confirmation page data.Would I need to post the Order page and Confirmation page code here in this thread to get a better answer and specific help?I would greatly appreciate any and all help because I am just waiting to complete these two web pages to publish my site to the 'Net.-JM

Link to comment
Share on other sites

1) The Order page has tables with items and a checkbox at the end of each row. Of course all tables with their checkboxes are contained in a form. Once they check the boxes next to the item they would like, they click SUBMIT and the value of each checkbox is passed to the Confirmation page. The value of each checkbox is just a two word phrase. There are currently maximum of 100 checkboxes than can be checked so I don't know if that classifies as alot of information being passed if they are all checked. 2) The Confirmation page opens displaying the choices they checked and the calculated price and choice of payment option and delivery method. Then CONFIRM ORDER is clicked.3) All the information on the Confirmation page is then sent via email to my email account.So all I need is to know what and how to code the Confirmation page to display what is in #2 above and how then to send the information displayed in the Confirmation page to an email that goes to me.Could someone please help me?!-JMareel

Link to comment
Share on other sites

HI!To get values from a form you need to use $_POST, Example (get a value from a field called name):

<?php echo $_POST['name']; // Here we just echo it out to the browser...?>

What you do with the values depends on what you want to do...It's hard to give good examples without more info.You could then save the information to an db, textfile or use a form and hidden fields to keep the data to the next (mailing) page.Then you can use mail() to send the email.Hope that helped some, if you need more help, just ask. :?)Good Luck and Don't Panic!

Link to comment
Share on other sites

im having the same prob .. here is a site that can helphttp://paypaltech.com/content/index.php?op...4&Itemid=51i dont know how info would get back to my site , they r saying that once the user clicks on the continue button will be taken to some certain page of my site (do paypal provide such a thing or do i need to use a code for it ) ?and wanted to ask is it safe to use hidden fields ?? any other way to do it .. ?

Link to comment
Share on other sites

To pass form information from one page to a third page, the best ways to do it are to either use hidden form fields to simply re-post the entire form to the next page, or use the session to store all of the form information, and read from the session on the third page to get it all back.

Link to comment
Share on other sites

Should I post the code of my Order page and what I have so far of my Confirmation page here in this thread so somebody with coding knowledge can help me out? I am just too anxious to get this problem solved so I can publish to the 'Net. Thank you so much for all the replies so far.-JMareel

Link to comment
Share on other sites

You can post the code if you want. It's probably best to use sessions, so you can read about that here:http://www.php.net/manual/en/ref.session.phpYou need to use session_start on the top of any page you want to access the session on, and then you can use the $_SESSION array to set and read the values. It would be really easy on the confirmation page to just say this:$_SESSION['postdata'] = $_POST;so you save the entire $_POST array into the session, and then on the following page you can read the form information like this:$_SESSION['postdata']['username'];$_SESSION['postdata']['email'];$_SESSION['postdata']['comments'];etc

Link to comment
Share on other sites

OK I guess I'll try to figure out myself how to code the data to go to each page by studying how to use the SESSION parameter :) Another question I have is how do I have the Confirmation page count the number of items they checked so I can use that number to calculate the price? So if they checked 20 items then I want the Confirmation page to display the values of the checked items and then display total price by using the formula TOTAL PRICE = [# OF ITEMS] * [PRICE]? Could somebody help to code this and whatever else I need in my Confirmation page? Thanks much in advance :) -JM

You can post the code if you want. It's probably best to use sessions, so you can read about that here:http://www.php.net/manual/en/ref.session.phpYou need to use session_start on the top of any page you want to access the session on, and then you can use the $_SESSION array to set and read the values. It would be really easy on the confirmation page to just say this:$_SESSION['postdata'] = $_POST;so you save the entire $_POST array into the session, and then on the following page you can read the form information like this:$_SESSION['postdata']['username'];$_SESSION['postdata']['email'];$_SESSION['postdata']['comments'];etc
Link to comment
Share on other sites

How do you name the checkboxes?If they have a name like item[] or product[] you get them as an array and can use this:

$item_count = count($_POST['item'];

If you have named them item1, item2, item3 etc it gets a little bit trickier, you need to use a for loop like this (there's probably a better way to do this):

$item_count = 0;for ($i = 1; $i <= 100; $i++) {	 if (isset($_POST['item'.$i]))		  $item_count++;}

Good Luck and Don't Panic! :?)

Link to comment
Share on other sites

I have an "allbox" checkbox at the top of each table and below it regular checkboxes. If the "allbox" checkbox is checked it will in turn check all the boxes in that table only.The allbox checkboxes are named table1_allbox, etc.The item checkboxes are named table1_ItemName and value is ItemName, etc.-JM

How do you name the checkboxes?If they have a name like item[] or product[] you get them as an array and can use this:
$item_count = count($_POST['item'];

If you have named them item1, item2, item3 etc it gets a little bit trickier, you need to use a for loop like this (there's probably a better way to do this):

$item_count = 0;for ($i = 1; $i <= 100; $i++) {	 if (isset($_POST['item'.$i]))		  $item_count++;}

Good Luck and Don't Panic! :?)

Link to comment
Share on other sites

You will have to get the list of item names and check each one to see if it was set. If it was set, then the user checked the box. It would be easier to set all of the checkbox names to be the same thing and use it as an array. That way you wouldn't need to get the list of item names and check each one yourself, you just go through the list and find out which ones were checked.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...