My profile.php is not updating properly. When I click my update button, nothing happens. The table information does not update. Here is my code:
<?php
session_start();
include_once('config.php');
$current_url = base64_encode($url='http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
if(isset($_SESSION['Email'])){
$email = $_SESSION['Email'];
if(isset($_POST['update'])){
$UpdateQuery = "UPDATE customers SET Email='$_POST[email]', Firstname='$_POST[firstname]', Lastname='$_POST[lastname]', Gender='$_POST[gender]', Titlename='$_POST[titlename]', BirthMonth='$_POST[bm]', BirthDay='$_POST[bd]', BirthYear='$_POST[by]', Company='$_POST[company]', CellphoneNumber='$_POST[cn]', PhoneNumber='$_POST[pn]' Province='$_POST[province]', Barangay='$_POST[barangay]', Address1='$_POST[add1]', Address2='$_POST[add2]' WHERE Email='$_POST[hidden]'";
mysqli_query($mysqli,$UpdateQuery);
}
$query = $mysqli->query("SELECT * FROM customers WHERE Email='$email'");
if($query){
while($obj = $query->fetch_object()){
echo '<form action="profile.php" method="POST">';
echo 'Email<input type="text" name="email" value="'.$obj->Email.'"><br />';
echo 'Firstname<input type="text" name="firstname" value="'.$obj->Firstname.'"><br />';
echo 'Lastname<input type="text" name="lastname" value="'.$obj->Lastname.'"><br />';
echo 'Gender<input type="text" name="gender" value="'.$obj->Gender.'"><br />';
echo 'Title name<input type="text" name="titlename" value="'.$obj->Titlename.'"><br />';
echo 'BirthMonth<input type="text" name="bm" value="'.$obj->BirthMonth.'"><br />';
echo 'BirthDay<input type="text" name="bd" value="'.$obj->BirthDay.'"><br />';
echo 'BirthYear<input type="text" name="by" value="'.$obj->BirthYear.'"><br />';
echo 'Company<input type="text" name="company" value="'.$obj->Company.'"><br />';
echo 'CellphoneNumber<input type="text" name="cn" value="'.$obj->CellphoneNumber.'"><br />';
echo 'PhoneNumber<input type="text" name="pn" value="'.$obj->PhoneNumber.'"><br />';
echo 'Province<input type="text" name="province" value="'.$obj->Province.'"><br />';
echo 'Barangay<input type="text" name="barangay" value="'.$obj->Barangay.'"><br />';
echo 'Address1<input type="text" name="add1" value="'.$obj->Address1.'"><br />';
echo 'Address2<input type="text" name="add2" value="'.$obj->Address2.'"><br />';
echo '<input type="hidden" name="hidden" value="'.$obj->Email.'">';
echo '<input type="submit" name="update" value="Update">';
echo '</form>';
}
}
}
else
{
die('Please log in your accoount to view this section');
}
?>
And also, please help me to put some "Alert message" that will be displayed when you have successfully updated the information. Please give me advice on how to get rid of that error.