Results 1 to 4 of 4

Thread: [RESOLVED] Send array to class function

  1. #1

    Thread Starter
    Frenzied Member I_Love_My_Vans's Avatar
    Join Date
    Jan 2005
    Location
    In the PHP compiler
    Posts
    1,275

    Resolved [RESOLVED] Send array to class function

    Hello!

    Heres what I am doing.

    I have a form, it takes infor from use, including some images (important), it posts the variables back to the same page where they are picked up.

    When this has been done before all the code is kept in the same page, but I am now going OOP and starting to use classes, its working really well, but it wont for some reason let me post the $_FILES['small_img'] to the class.

    c0d

    Code:
    $product->setAddProduct($_POST['title'], $_POST['category'], $_POST['description'], $_POST['stock'], $_POST['price'], $_FILES['small_img'], $_FILES['large_img']);
    Thanks

  2. #2

    Thread Starter
    Frenzied Member I_Love_My_Vans's Avatar
    Join Date
    Jan 2005
    Location
    In the PHP compiler
    Posts
    1,275

    Re: Send array to class function

    Sorted! I just send the $_FILES and picked it up the other end.

    Thanks Me! How do I rep myself?

  3. #3
    WiggleWiggle dclamp's Avatar
    Join Date
    Aug 2006
    Posts
    3,527

    Re: Send array to class function

    Quote Originally Posted by I_Love_My_Vans
    Sorted! I just send the $_FILES and picked it up the other end.

    Thanks Me! How do I rep myself?
    you can just give it the rep to me, if you want

    i didnt know you can send $_FILES to a class..
    My usual boring signature: Something

  4. #4

    Thread Starter
    Frenzied Member I_Love_My_Vans's Avatar
    Join Date
    Jan 2005
    Location
    In the PHP compiler
    Posts
    1,275

    Re: [RESOLVED] Send array to class function

    Well this is what I was using...

    Code:
    $product->setAddProduct($_POST['title'], $_POST['category'], $_POST['description'], $_POST['stock'], $_POST['price'], $_FILES['small_img'], $_FILES['large_img']);
    But this is what worked... (NB! See code at very end of string)

    Code:
    $product->setAddProduct($_POST['title'], $_POST['category'], $_POST['description'], $_POST['stock'], $_POST['price'], $_FILES['small_img'], $_FILES;
    I sent just $_FILES, and when in the class functon printed it using print_r and the entire array appeared as it would in the original file.

    I wonder if this can be done with $_POST and $_GET, all they really are is arrays?

Posting Permissions

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



Click Here to Expand Forum to Full Width