# Assigning unique variable names (sounds like it should be easy . . .)

**URL:** <https://forum.kirupa.com/t/assigning-unique-variable-names-sounds-like-it-should-be-easy/268106>\
**Category:** flash\
**Created:** [August 9, 2008, 8:07pm UTC](https://forum.kirupa.com/t/assigning-unique-variable-names-sounds-like-it-should-be-easy/268106 "2008-08-09T20:07:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![elihorn](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/elihorn/32/2458_2.png) [@elihorn](https://forum.kirupa.com/u/elihorn)\
**Post date:** [August 9, 2008, 8:07pm UTC](https://forum.kirupa.com/t/assigning-unique-variable-names-sounds-like-it-should-be-easy/268106/1 "2008-08-09T20:07:54Z")

</div>

This seems like it should be so easy, I feel stupid asking, but I can’t figure it out:

I’m trying to pass shopping cart items to PayPal from Flash using URLVariables. PayPal reads each cart item as ‘item\_name\_1’, ‘item\_name\_2’, ‘item\_name\_3’, … etc. so I want to create a new ‘item\_name\_’ variable for each item in the shopping cart. The problem is I can’t just assign a variable as item\_name\_+i, so how would I go about this? Here is the code I’m using:

```auto
 private function checkOut(event:MouseEvent)
{
        var variables:URLVariables = new URLVariables();
        for (var i:* in iList) {
            [COLOR=Red][COLOR=Black]variables.[/COLOR]item_name_+i[COLOR=Black] = iList*.name;
             variables.[/COLOR]amount_+i [COLOR=Black]= iList*.price;[/COLOR][/COLOR]
         }
         var request:URLRequest = new URLRequest("https://www.paypal.com/cgi-bin/webscr");
         request.method = URLRequestMethod.POST;
         request.data = variables;
         navigateToURL(request);
}

```

Thanks for the help!
