Page 3 of 3 FirstFirst 123
Results 21 to 24 of 24

Thread: Dynamically change a variables name

  1. #21
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    It's a lot less confusing when indented properly. As for your braces, that's even more confusing, because it's still flat and you've put your braces in a configuration that doesn't make sense to anybody :-\
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  2. #22
    Join Date
    May 2007
    Location
    England, UK
    Posts
    235
    Thanks
    3
    Thanked 6 Times in 6 Posts

    Default

    Yes I have already changed it to:
    PHP Code:
    $temp = array();
    foreach(
    $id as $k => $v)
        {
        for(
    $i 0$i $qty[$k]; ++$i)
            {    
            
    $temp[] = $v;    
            }
        }
    $cart "array ('"implode("','",$temp)."')"
    However, I have come across another problem going back a few steps.

    I initially created this $id array from a form that sends all the values from a hidden input field e.g.
    HTML Code:
    <input type="hidden" name="id[]" value="$variable" />
    Because the form uses $_GET, it adds each value to the url.

    However if I have say 200 values to get, it cuts the array off early. probably because the url if far too long.

    Is there any way around this?

  3. #23
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Use POST.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  4. #24
    Join Date
    May 2007
    Location
    England, UK
    Posts
    235
    Thanks
    3
    Thanked 6 Times in 6 Posts

    Default

    already tried that but it didn't work! thought it was something to do with the way the form values set the array.

    Got it to work now though.

    Thanks for all the effort!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •