Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Nov 2007
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    $_POST and array

    I'm passing 100 variables (named gaintxt0, gaintxt1....gaintxt100) using a POST. I would like to put these variables into an array. However, I'm having trouble with the syntax for the $_POST.

    I'm trying to do something like this, but it's not working:

    PHP Code:
    <?
    $myArray 
    = array();

    for(
    $i=0$i<=100$i++){
       
    array_push($myArray$_POST[gaintxt[$i]]);
    }

    ?>
    Any ideas?

  • #2
    Senior Coder
    Join Date
    Apr 2007
    Location
    Quakertown PA USA
    Posts
    1,028
    Thanks
    1
    Thanked 125 Times in 123 Posts
    PHP Code:
    <?
    $myArray 
    = array();

    for(
    $i=0$i<=100$i++){
       
    array_push($myArray$_POST['gaintxt' $i]);
    }

    ?>
    John


  •  

    Posting Permissions

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