SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Wizard lukeurtnowski's Avatar
    Join Date
    Mar 2003
    Location
    Coronado
    Posts
    1,658
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    Array acting screwey?

    I have a simple form,
    HTML Code:
    <form method="POST" action="#">
    <fieldset>
    <legend>All images inside 1 directory</legend>
    <input type='checkbox' value='1383680050-(at).svg.png' name='image_to_move[]' />
    <img src=images/1/1383680050-(at).svg.png style='height:70px' />
    <input type='checkbox' value='1383680050-252.png' name='image_to_move[]' />
    <img src=images/1/1383680050-252.png style='height:70px' />
    <input type='checkbox' value='1383680050-258.JPG' name='image_to_move[]' />
    <img src=images/1/1383680050-258.JPG style='height:70px' />
    <input type='checkbox' value='1383680050-avatar.jpg' name='image_to_move[]' />
    <img src=images/1/1383680050-avatar.jpg style='height:70px' />
    </fieldset>
    <input type="submit" value="Move Images" />
    </form>
    But When I submit and check the _POST[] and the image_to_move[]
    using
    PHP Code:
    echo "<pre>"print_r($_POST); echo "</pre>";
    echo 
    "<hr>";
    echo 
    "<pre>"print_r($image_to_move); echo "</pre>"
    All I get is
    <pre>Array
    (
    [image_to_move] => Array
    (
    [0] => 1383680050-252.png
    )

    )
    </pre><hr><pre></pre>

    why is the 2nd array shown as not there?
    "Oh, and Jenkins--apparently your mother died this morning."

  2. #2
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    Location
    The Netherlands
    Posts
    9,096
    Mentioned
    153 Post(s)
    Tagged
    2 Thread(s)
    Because it's $_POST['image_to_move'], not $image_to_move.

    Off Topic:


    There used to be a time where $image_to_move would have been automatically created for you by PHP if you had so called superglobals enabled in php.ini. Since it was as big a security risk as leaving your front door open in the middle of a busy street when you went away for a few hours that option is no longer available in PHP
    Rémon - Hosting Advisor

    SitePoint forums will switch to Discourse soon! Make sure you're ready for it!

    Minimal Bookmarks Tree
    My Google Chrome extension: browsing bookmarks made easy

  3. #3
    SitePoint Wizard lukeurtnowski's Avatar
    Join Date
    Mar 2003
    Location
    Coronado
    Posts
    1,658
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    thanks
    "Oh, and Jenkins--apparently your mother died this morning."


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
  •