Hiya. I am new to PHP and glad I finally found readable forum to ask questions in!
This was simple to work around in this instance, but since it is somthing that surpised me I am concerned about future problems and code portability. My form did not do this running locally (PHP 4.2) but when I uploaded it to check it on an online server (PHP 4.1.2) I got strange errors.
First the form allows the user to upload picturs using a file input:
<input type="file" name="pic3" size="35">
PHP then validates against known image formats and acts accordingly.
if (isset($pic3)&&!empty($pic3)){
validate....
The problem was that I was getting errors thrown from trying to validate images that were not being attempted. It turned out PHP was assigning the value of 'none' to empty entries. The fix, in this case, was to modify the check:
if (isset($pic3)&&!(empty($pic3)||$pic3=="none"){
Did I miss something in the documentation? Does this only affect file inputs or is there other 'gotchas' I need to look out for? I also realize it seems redundant to have isset() and !empty() in the same conditional statement but once I uploaded the script, PHP seemed to find inputs as set even when they were not. Any comments on this behavior?