cyber0ne Posted October 15, 2006 Share Posted October 15, 2006 This may be a very simple problem that I'm just not seeing, but maybe another set of eyes looking at it will be able to pick out what I'm doing wrong. I have some PHP code that outputs the following editavatar.php (stripped down for brevity): <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html> <head> <title>cyber0ne.com</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> </head> <body> <form action="/users/editavatar.php" method="POST" enctype="multipart/form-data"> <input type="file" class="POST" name="userAvatar" /><br /> <input type="hidden" name="updateAvatar" value="1" /><input type="submit" name="postAvatar" value="Submit" /> </form> </body></html> For some reason, whenever I post back with the Submit on the form, the post values (in the $_POST array in PHP) for userAvatar and updateAvatar are empty. Is there something wrong with the HTML on this that would be causing the post to be empty, or in some way incorrect? Link to comment Share on other sites More sharing options...
www.mihalism.com Posted October 16, 2006 Share Posted October 16, 2006 When using file inputs dont use $_POST[''] use $HTTP_POST_FILES['']; like to display the file name of the selected file you would do $HTTP_POST_FILES['userAvatar']['name'] Link to comment Share on other sites More sharing options...
cyber0ne Posted October 16, 2006 Author Share Posted October 16, 2006 When using file inputs dont use $_POST[''] use $HTTP_POST_FILES['']; like to display the file name of the selected file you would do $HTTP_POST_FILES['userAvatar']['name']Ah, you're right about that. But wouldn't that hidden field still be available in $_POST? In any event, I don't really need that hidden field. And if I need any other $_POST values on that form, I can hop on over to the PHP forum.Thanks Link to comment Share on other sites More sharing options...
www.mihalism.com Posted October 16, 2006 Share Posted October 16, 2006 Your hidden field will work with $_POST because its nothing special just a hidden field i dont even see a reason for it why not just define it in the php instead of using a hidden field Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now