When i enter in edit.profile.php i get echo "Your profile has been updated! " and normal form without any editing instead of echo 'Click update to edit your profile.';
I dont have any errors or anything, maybe i should fetch user with something else or there is a problem in a code? Or i have to connect this with my login.php script?
edit.profile.php
<?php
include('core/init.inc.php');
$errors = array();
if (empty($errors)){
$grad = htmlentities($_POST['grad']);
$drzava = htmlentities($_POST['drzava']);
$fan = htmlentities($_POST['fan']);
$website = htmlentities($_POST['website']);
$titles = htmlentities($_POST['titles']);
$user_info = array();
$user_info['grad'] = "$grad";
$user_info['drzava'] = "$drzava";
$user_info['fan'] = "$fan";
$user_info['website'] = "$website";
$user_info['titles'] = "$titles";
}else{
$user_info = fetch_user_info($_SESSION['uid']);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>Global Betting</title>
</head>
<body>
<div>
<?php
if (isset($errors) ==false){
echo 'Click update to edit your profile.';
}else if (empty($errors)){
echo 'Your profile has been updated!';
}else{
echo '<ul><li>'. implode('</li><li>'. $errors). '</li></ul>';
}
?>
</div>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method ="POST">
<div>
<label for="grad">Grad</label>
<input type="text" name="grad" id="grad" value="<?php echo $user_info['grad']; ?>" />
</div>
<div>
<label for="drzava">Drzava</label>
<input type="text" name="drzava" id="drzava" value="<?php echo $user_info ['drzava']; ?>" />
</div>
<div>
<label for="fan">Fan</label>
<input type="text" name="fan" id="fan" value="<?php echo $user_info ['fan']; ?>" />
</div>
<div>
<label for="grad">Website</label>
<input type="text" name="website" id="website" value="<?php echo $user_info ['website']; ?>" />
</div>
<div>
<label for="Titles">Titles</label>
<input type="titles" name="titles" id="titles" value="<?php echo $user_info ['titles']; ?>" />
</div>
<div>
<input type="submit" value="Update" />
</div>
</form>
</body>
</html>