Ejemplo n.º 1
0
function update($establishment)
{
    $e = new Establishment();
    $boolean = $e->isValid($establishment);
    if ($boolean == false) {
        $msg = serialize("Validation fail. Fill all form inputs.");
        header("Location: ../views/editProfileEstablishment.php?val={$msg}");
    } else {
        $id = $_SESSION["name"];
        $bool = $e->update($establishment, $id);
        if ($bool == true) {
            $_SESSION["name"] = $establishment["name"];
            $msg = serialize("Your profile have been updated.");
            header("Location: ../views/editProfileEstablishment.php?upd={$msg}");
        } else {
            $msg = serialize("Server Error: Profile not changed");
            header("Location: ../views/editProfileEstablishment.php?err={$msg}");
        }
    }
}