<?php 
include 'check.php';
include '../db.inc.php';
include 'check_msg.php';
$ac=$_GET['user'];
$sql="SELECT * FROM users WHERE number='$ac'";
$query=mysqli_query($connectionString,$sql);
$get=mysqli_fetch_array($query,MYSQLI_ASSOC);
if(isset($_POST['submit'])) {
	$firstname=$_POST['firstname'];
	$lastname=$_POST['lastname'];
	$dob=$_POST['dob'];
	$gender=$_POST['gender'];
	$address=$_POST['address'];
	$city=$_POST['city'];
	$state=$_POST['state'];
	$zip=$_POST['zip'];
	$country=$_POST['country'];
	$email=$_POST['email'];
	$phone=$_POST['phone'];
	$fax=$_POST['fax'];
	$occupation=$_POST['occupation'];
        $currency=$_POST['currency'];
	
  if(!mysqli_query($connectionString,"UPDATE users SET firstname='$firstname', lastname='$lastname', dob='$dob', gender='$gender', `address`='$address', city='$city', state='$state', zip='$zip', country='$country', email='$email', phone='$phone', occupation='$occupation', currency='$currency' WHERE number='$ac' LIMIT 1 ;")) {
    echo("Error description: " . mysqli_error($connectionString));exit;
  }

	echo "<script type='text/javascript'>alert('Details Successfully Updated');
location.replace('./');</script>";

	}

	
	
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Administrator</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="css/style.css" rel="stylesheet" type="text/css">
</head>

<body>
<table width="96%" height="421" border="0" cellspacing="5">
  <tr>
    <td width="14%" height="274" valign="top" style="border:#003399 1px solid;"><table width="100%" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td height="21" bgcolor="#004500" class="headers">Navigation</td>
      </tr>
      <tr>
        <td><table width="100%" border="0" cellspacing="1">
          <tr>
            <td bgcolor="#E8FFF8"><p><font size="2" face="Arial, Helvetica, sans-serif"><strong><a href="./">Home</a></strong></font></p></td>
          </tr>
           <tr>
            <td bgcolor="#E8FFF8"><p><font size="2" face="Arial, Helvetica, sans-serif"><strong><a href="smssender.php">SMS 
              Sender</a></strong></font></p></td>
          </tr>
          <tr>
            <td bgcolor="#E8FFF8"><font size="2" face="Arial, Helvetica, sans-serif"><strong><a href="addact.php">Add Activity </a></strong></font></td>
          </tr>
          <tr>
            <td bgcolor="#E8FFF8"><a href="viewact.php"><font size="2" face="Arial, Helvetica, sans-serif"><strong>View Activities </strong></font></a></td>
          </tr>
          <tr>
            <td bgcolor="#E8FFF8"><a href="messages.php"><font size="2" face="Arial, Helvetica, sans-serif"><strong>View Messages (<?php echo $umsg; ?>)</strong></font></a></td>
          </tr>
          <tr>
            <td bgcolor="#E8FFF8"><a href="alerts.php"><font size="2" face="Arial, Helvetica, sans-serif"><strong>View Alerts</strong></font></a></td>
          </tr>
          
          <tr>
            <td bgcolor="#E8FFF8"><a href="sql.php"><font size="2" face="Arial, Helvetica, sans-serif"><strong>SQL</strong></font></a></td>
          </tr>
		  
          <tr>
            <td bgcolor="#E8FFF8"><font size="2" face="Arial, Helvetica, sans-serif"><strong><a href="logout.php">Log 
              Out</a></strong></font></td>
          </tr>
        </table>
        <p>&nbsp;</p>
          </td>
      </tr>
    </table>      
      <p>&nbsp;</p>
    </td>
    <td width="86%" valign="top" style="border:#003399 1px solid;"><table width="100%" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td height="21" bgcolor="#004500" class="headers">Edit Account </td>
      </tr>
      <tr>
        <td><form action="" method="post" enctype="multipart/form-data" name="form1" id="form1">
                  <table width="100%" border="0" cellspacing="1">
                    <tr>
                      <td colspan="2" bgcolor="#E8FFF8" class="error_msg"></td>
                    </tr>
                    <tr>
                      <td width="12%" bgcolor="#E8FFF8">First Name </td>
                      <td width="88%" bgcolor="#E8FFF8"><input name="firstname" type="text" id="firstname" value="<?php echo $get['firstname']; ?>" /></td>
                    </tr>
                    <tr>
                      <td bgcolor="#E8FFF8">Last Name </td>
                      <td bgcolor="#E8FFF8"><input name="lastname" type="text" id="lastname" value="<?php echo $get['lastname']; ?>" /></td>
                    </tr>
					<tr>
                      <td bgcolor="#E8FFF8">Date of Birth </td>
                      <td bgcolor="#E8FFF8"><input name="dob" type="date" id="dob" value="<?php echo $get['dob']; ?>" /></td>
                    </tr>
                    <tr>
                      <td bgcolor="#E8FFF8">Gender</td>
                      <td bgcolor="#E8FFF8"><input name="gender" type="text" id="gender" value="<?php echo $get['gender']; ?>" /> </td>
                    </tr>
                    <tr>
                      <td bgcolor="#E8FFF8">Address</td>
                      <td bgcolor="#E8FFF8"><input name="address" type="text" id="address" value="<?php echo $get['address']; ?>" size="50" /></td>
                    </tr>
                    <tr>
                      <td bgcolor="#E8FFF8">City</td>
                      <td bgcolor="#E8FFF8"><input name="city" type="text" id="city" value="<?php echo $get['city']; ?>" /></td>
                    </tr>
                    <tr>
                      <td bgcolor="#E8FFF8">State</td>
                      <td bgcolor="#E8FFF8"><input name="state" type="text" id="state" value="<?php echo $get['state']; ?>" /></td>
                    </tr>
                    <tr>
                      <td bgcolor="#E8FFF8">ZIP</td>
                      <td bgcolor="#E8FFF8"><input name="zip" type="text" id="zip" value="<?php echo $get['zip']; ?>" /></td>
                    </tr>
                    <tr>
                      <td bgcolor="#E8FFF8">Country</td>
                      <td bgcolor="#E8FFF8"><input name="country" type="text" id="bcountry" value="<?php echo $get['country']; ?>" /></td>
                    </tr>
                    <tr>
                      <td bgcolor="#E8FFF8">Email</td>
                      <td bgcolor="#E8FFF8"><input name="email" type="text" id="email" value="<?php echo $get['email']; ?>" /></td>
                    </tr>
                    <tr>
                      <td bgcolor="#E8FFF8">Phone</td>
                      <td bgcolor="#E8FFF8"><input name="phone" type="text" id="phone" value="<?php echo $get['phone']; ?>" /></td>
                    </tr>

					<tr>
                      <td bgcolor="#E8FFF8">Occupation</td>
                      <td bgcolor="#E8FFF8"><input name="occupation" type="text" id="occupation" value="<?php echo $get['occupation']; ?>" /></td>
                    </tr>
					
 
                      <tr>
                      <td bgcolor="#E8FFF8">Currency</td>
                      <td bgcolor="#E8FFF8"><input name="currency" type="text" id="currency" value="<?php echo $get['currency']; ?>" /></td>
                    </tr>
 
					  <tr>
                      <td bgcolor="#E8FFF8">&nbsp;</td>
                      <td bgcolor="#E8FFF8"><input name="submit" type="submit" id="submit" value="Save" />
                        <input name="Reset" type="reset" value="Reset" /></td>
					  </tr>
              </table>
              </form></td>
      </tr>
    </table>      
    </td>
  </tr>
</table>


</body>
</html>
