Zerpex Posted March 14, 2012 Share Posted March 14, 2012 Hia, I'm having a form, containing an image upload, a textarea and some other fields. I have a fileupload, where I check if the upload thingy is empty, with if(empty($_POST['image'])) { echo "Error"; } else { //Do the imageUpload here } using the empty, isn't working for some reason, it proceed to the else anyway. Also, I have a textarea with name="productDesc", when I do: <?php var_dump($_POST); ?> It doesn't return the textarea, and I can't see why it doesn't. Also the textarea proceed to the 'else' in the if else in the following code: http://codepad.org/wMd6SnoK Having a lot of questions these days Thank you guys! Quote Link to comment https://forums.phpfreaks.com/topic/258891-php-form-submittion-problem-with-file-and-textarea/ Share on other sites More sharing options...
Zerpex Posted March 14, 2012 Author Share Posted March 14, 2012 Update, I figured out the image thing! I was using $_POST instead of $_FILES! But still having the other problem with the textarea Quote Link to comment https://forums.phpfreaks.com/topic/258891-php-form-submittion-problem-with-file-and-textarea/#findComment-1327201 Share on other sites More sharing options...
Muddy_Funster Posted March 14, 2012 Share Posted March 14, 2012 can we see your form code aswell? N/M - I see it's on the same page Quote Link to comment https://forums.phpfreaks.com/topic/258891-php-form-submittion-problem-with-file-and-textarea/#findComment-1327205 Share on other sites More sharing options...
Zerpex Posted March 14, 2012 Author Share Posted March 14, 2012 In my head if(empty($brandid) && empty($_FILES['image']) && empty($_POST['productDesc'])) should be true, if just one of them is empty (which the image and textarea) is at the moment, but it still returns false, so it proceed to the actual imageupload :/ it should do the error Quote Link to comment https://forums.phpfreaks.com/topic/258891-php-form-submittion-problem-with-file-and-textarea/#findComment-1327209 Share on other sites More sharing options...
Muddy_Funster Posted March 14, 2012 Share Posted March 14, 2012 nope, that code is checking if all three are empty, not if any one is empty, you need to use the or operator to check if any one is empty. Quote Link to comment https://forums.phpfreaks.com/topic/258891-php-form-submittion-problem-with-file-and-textarea/#findComment-1327211 Share on other sites More sharing options...
Zerpex Posted March 14, 2012 Author Share Posted March 14, 2012 nope, that code is checking if all three are empty, not if any one is empty, you need to use the or operator to check if any one is empty. stupid me ! Quote Link to comment https://forums.phpfreaks.com/topic/258891-php-form-submittion-problem-with-file-and-textarea/#findComment-1327217 Share on other sites More sharing options...
Muddy_Funster Posted March 14, 2012 Share Posted March 14, 2012 working now? Quote Link to comment https://forums.phpfreaks.com/topic/258891-php-form-submittion-problem-with-file-and-textarea/#findComment-1327236 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.