Assistance with if..elseif statement

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have this block of code which checks to see if an image has been uploaded from an update form. Everything in the form works, except I can not get the the elseif statements to behave properly. See the comments below for explanation. Any help would be appreciated.

$route_photo = $_FILES['image']['name'];

// if no new image and no existing image put NULL in the DB
 if(empty($_FILES['image']['name']) && ($_POST['oldimage']) == '')
        {
            $route_photo = 'NULL';
             echo ("No image supplied.");

// if new image put the new image name in the DB
} elseif ($_POST['route_photo'] || $_FILES['image']['name']) {
$route_photo = $_POST['route_photo'];
echo ("The image has been replaced with $route_photo.");


// If no new image update, use the old image
        }  elseif ($_POST['route_photo'] = $_POST['oldimage'])
                    {
                     $route_photo = $_POST['oldimage'];
                        echo("No new image supplied");
                    }

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux