Unsure of how to format this particular bit of php

Hey,

Basically I am testing out CheddarGetters api by creating a simple shopping basket. I have created a form to gather peoples information and then they select the products they wish to purchase.

Here is the part of the form where they choose their products…

<input type="checkbox" name="plan[]" value="PRODUCT_1">Product 1<br />

<input type="checkbox" name="plan[]" value="PRODUCT_2">Product 2<br />

<input type="checkbox" name="plan[]" value="PRODUCT_3">Product 3<br />

and here is the code that echos out their selection(s) in the format that I need to include into the api code…
[php]
if (is_array($_POST[‘plan’]))
{
foreach ($_POST[‘plan’] as $a) {

    echo "'planCode'  =>  '". $a . "'";      

}
}
[/php]

Echo Result

'planCode' => 'PRODUCT_1'

My question is rather than echo out that result how do I store it in a variable for me to then nest with in the api code further down the page.

I’ve tried to do this myself but i just keep getting white screen :confused:

Thanks

(hope this makes sense and I’ve posted it in the right place… and it’s even possible :S)

(replied as I can’t edit my post)

I need the variable to be able to store more than one result as well, which I think is where I’m getting confused to where I have to put it.

Sponsor our Newsletter | Privacy Policy | Terms of Service