There is no way to go. this post is about the problem of two-step form submission and passing arrays. at last, kiseki_m made an image upload function in step 2012-11-0916: 11: 45, on the home page, you can select multiple users through the checkbox interface. after selecting this option, click upload to go to the second upload page. there is no way to go. about the two-step submission of the form to pass the array
At the end of this post, kiseki_m edited the younger brother at 16:11:45 on to upload images. Multiple users can be selected on the home page through the checkbox, and then click upload to go to the second upload page, you can upload images to multiple user directories in batches, but now the problem arises. The first page uses the user ID array passed by the checkbox to go to the second page to upload images, which still exists at the beginning, however, after you click the "upload" button, that is, after submitting the second page, a foreach error will be prompted, which means the array does not exist ...... It seems that the session cannot be obtained ...... Help the ball ......
The second page, key page code:
Session_start ();
Require_once ('Pic _ fns. php ');
Include ("upload. class. php ");
$ Edit_me = $ _ POST ['edit _ me']; // The Data selected by the checkbox is stored in the edit_me array.
$ Valid_user = $ _ SESSION ['valid _ user']; // checks whether a user logs on.
Do_html_header ("Upload image advertisement Upload pic for machine ");
Try {
Check_valid_user (); // checks whether to log on
} Catch (Exception $ e ){
Echo $ e-> getMessage ();
Do_html_url ('login _ admin. php', 'Return ');
Do_html_footer ();
Exit;
}
Foreach ($ edit_me as $ k) {// upload images cyclically. after submission, the data of WARNING foreach is empty.
If ($ _ POST ['submit ']) {// image Upload part
$ Image = new upload_image ();
$ Image-> get_file_dir ("pic/". $ k. "/"); // file storage directory
$ Image-> get_upload_name ($ _ FILES ['file'] ['name']);
$ Image-> get_upload_size ($ _ FILES ['file'] ['size']);
$ Image-> get_upload_type ($ _ FILES ['file'] ['type']);
$ Image-> get_upload_tamp ($ _ FILES ['file'] ['tmp _ name']);
$ Image-> upload ();
Display_user_menu ();
Do_html_footer;
}
}
?>
Display_user_menu ();
Do_html_footer;
?>
If you create a new array at the beginning of this page, you can upload images cyclically, but the passed array does not know why it doesn't work. please help me ......
------ Best solution --------------------