PDA

Click to See Complete Forum and Search --> : [RESOLVED] Send array to class function


I_Love_My_Vans
Mar 14th, 2008, 12:26 PM
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

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

Thanks :)

I_Love_My_Vans
Mar 14th, 2008, 02:42 PM
Sorted! I just send the $_FILES and picked it up the other end.

Thanks Me! How do I rep myself?

dclamp
Mar 14th, 2008, 05:49 PM
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..

I_Love_My_Vans
Mar 15th, 2008, 03:27 AM
Well this is what I was using...

$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)

$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?