[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.2

Passing the dynamic content as hidden input to secure server external page

Asked by justaj in Web Languages/Standards, PHP Scripting Language

Tags: PHP

Hi,
I am building a simple online shop. I found a cart and added a form, everything seems to be working ok, but now I have to pass the final content through a hidden input to the external payment system.

I need to pass the DESCRIPTION of each choosen item (a course), which will include (1) type of a course, date when it starts and ends, (2) how many places are chosen, (3) what is the price per unit and a TOTAL PRICE for all items.

I got to the point where after user choses everything and fills in the form with a name and address, I amended the cart function, so it will display results on a page without giving the user any more chance to change it and at this point I want to include a 'Proceed to secure payment' button.

The courses and prices are pulled from MySql database and I don't know how to pass the information further. I have it in two separate functions and somebody suggested putting it in one to avoid using global variables, but it still didn't work and on the new page where the payment should be proceed i am getting error that the total is not a valid value and the description is blank.

How can I pass the values from my function? please see the code below:
//I'm displaying the final choice on the page with function checkout
function checkout() {
      global $db;
      $cart = $_SESSION['cart'];
      if ($cart) {
            $items = explode(',',$cart);
            $contents = array();
            foreach ($items as $item) {
                  $contents[$item] = (isset($contents[$item])) ? $contents[$item] + 1 : 1;
            }
            $output[] = '<table border="1" id="shop">';
                  $output[] = '<tr>';
                  $output[] = '<td><strong>Item</strong></td>';
                  $output[] = '<td><strong>Quantity</strong></td>';
                  $output[] = '<td><strong>Total per item</strong></td>';
                  $output[] = '</tr>';
            foreach ($contents as $id=>$qty) {
                  $sql = 'SELECT * FROM courses WHERE id = '.$id;
                  $result = $db->query($sql);
                  $row = $result->fetch();
                  extract($row);
                  $output[] = '<tr>';
                  $output[] = '<td><strong>'.$title.'</strong> <br /> '.$start_date.' '.$end_date.' <br /> '.$weeks.'</td>';
                  $output[] = '<td>'.$qty.'</td>';
                  $output[] = '<td>&pound;'.($price * $qty).'</td>';
                  $total += $price * $qty;
                  $output[] = '</tr>';

            }
                  $output[] = '<tr >';
                  $output[] = '<td colspan="2"><strong>Total for all items:</strong></td>';
                  $output[] = '<td colspan="2"><strong>&pound;'.$total.'</strong></td>';
                  $output[] = '</tr>';
            $output[] = '</table>';
            $output[] = '<p>&nbsp;</p>';
      }
      return join('',$output);
}  

//I want to pass the description for each chosen course (which will include $title $start_date $end_date $weeks as well as how many of those courses are purchases ($qty) and what is the price per course ($price)) and apart from that list a total price for all, I'm putting it in the form, which will direct me to the secure server, but unfortunately the values don't go through:

<form action="https://xxx.com" method=POST target="_blank">
<input type=hidden name="testMode" value="123">
<input type=hidden name="instId" value="1234">
<input type=hidden name="cartId" value="1234567">
<input type=hidden name="amount" value="<?php print $title; ?>">
<input type=hidden name="currency" value="GBP">
<input type=hidden name="desc" value="<?php print $title . '</strong> <br /> ' . $start_date . ' ' . $end_date . ' <br /> (' . $weeks . ') x ' . $qty; ?>">
<input type=hidden name="name" value="<?php print htmlspecialchars($_POST['firstname']) . ' ' . htmlspecialchars($_POST['lastname']); ?>">
<input type=hidden name="address" value="<?php print (htmlspecialchars($_POST['address']) . ', ' . htmlspecialchars($_POST['town'])); ?>">
<input type=hidden name="postcode" value="<?php print htmlspecialchars($_POST['postcode']); ?>">
<input type=hidden name="country" value="<?php print htmlspecialchars($_POST['country']); ?>">
<input type=hidden name="tel" value="<?php print htmlspecialchars($_POST['telephone']); ?>">
<input type=hidden name="email" value="<?php print htmlspecialchars($_POST['email']); ?>">
<input type=submit value="Proceed to secure server">
</form>

Please note, that I am a beginner in PHP. :)
Thank you!

j.
[+][-]11/07/08 12:11 AM, ID: 22902486Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/07/08 05:48 AM, ID: 22904208Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/07/08 11:54 AM, ID: 22907942Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/07/08 12:20 PM, ID: 22908148Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/07/08 03:22 PM, ID: 22909401Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/07/08 04:01 PM, ID: 22909582Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/08/08 06:55 AM, ID: 22912631Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/09/08 01:33 AM, ID: 22915658Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/09/08 03:28 AM, ID: 22915845Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/09/08 12:02 PM, ID: 22917447Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/09/08 12:27 PM, ID: 22917547Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/09/08 12:39 PM, ID: 22917588Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/09/08 01:11 PM, ID: 22917751Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/09/08 01:18 PM, ID: 22917785Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/09/08 01:19 PM, ID: 22917794Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/09/08 01:23 PM, ID: 22917804Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/09/08 01:40 PM, ID: 22917862Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/09/08 05:03 PM, ID: 22918537Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/09/08 05:04 PM, ID: 22918540Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/10/08 05:10 AM, ID: 22921043Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/10/08 08:12 AM, ID: 22922779Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/10/08 08:14 AM, ID: 22922811Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/10/08 11:03 AM, ID: 22924385Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/10/08 11:18 AM, ID: 22924528Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zones: Web Languages/Standards, PHP Scripting Language
Tags: PHP
Sign Up Now!
Solution Provided By: lpxtech
Participating Experts: 1
Solution Grade: A
 
[+][-]11/10/08 11:38 AM, ID: 22924732Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/10/08 01:36 PM, ID: 22925803Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/10/08 01:54 PM, ID: 22925982Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/10/08 02:00 PM, ID: 22926033Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/10/08 02:07 PM, ID: 22926108Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/10/08 02:10 PM, ID: 22926128Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/12/08 09:52 AM, ID: 22942220Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-89 - Hierarchy / EE_QW_2_20070628