functions and looping

In HTML table I have 7 different tours (sightseeing tours).
The table has 5 columns:

TOUR CODE: (examples below)
<input type="hidden" value="AEPN4" name="TourCode1">
<input type="hidden" value="AEPSP4" name="TourCode2">

TOUR NAME: (examples below)
<input type="hidden" value="Walking Guided Tour" name="TourName1">
<input type="hidden" value="Day Tour" name="TourName2">

PRICE: (examples below)
<input type="hidden" name="PriceWGT" value="15" onChange="calculate()">
<input type="hidden" name="PriceDT" value="54" onChange="calculate1()">

* The WGT for example is the initial tour name and the JavaScript doing the calculation of the Price and the number of tickets the user selects.

QUANTITY: (examples below)
 <select name="QuantityWGT" onChange="calculate()">
<select name="QuantityDT" onChange="calculate1()">

TOTAL: (examples below)
<input type="text" size="8" name="TotalWGT">
<input type="text" size="8" name="TotalDT">

In the PHP page, the page that gets the variables I used thefunction, “if ($TotalWGT >0)” that’s in order to know which tour/s the user selected. Since I do not know so good how to build functions I actually did it for all the 7 tours. When the function is “true” it echo the all the information from the HTML table for the user last review. (e.g. Tour Code, Tour Name and so on).

THE PROBLEM:

In the review information page (the PHP page) after the user review its selections he has to click on a button that connects to third party credit card billing via CGI script.  

One of their requirements is to send in ONE SUBMITTED variable the information as follow: Tour Code, Number of tickets, and Total for each tour the user has selected.
So basically it can contain all of the 7 tours.

The total sum of all the tours I already managed to do. But I do not know how to “loop” to check which tours are selected and how to combine all this information into one submitted variable.

Please if someone can help me!!!!!
RefaelAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

TeRReFCommented:
Use a delimiter to store all the data (i.e. $variable = "var1|var2|var3|etc";) and then send it, they will have to parse it to retrieve all the values, but hey, they want it in one variable right? :)
You could also use an associative array to store the values.

To retrieve the seperate values, use the $_REQUEST variable to loop through the form.

if you need more pointers, let me know...
RefaelAuthor Commented:
Hi, it will be great if you can show me how it works, pls... i have no idea how to populate this as you suggested.
TeRReFCommented:
Hi Refael,

I guess you can use the info I gave you in your other question ;)
http://www.experts-exchange.com/Web/Web_Languages/PHP/Q_21737819.html

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.