title: Updating user profile details to MySQL
body: <p>I have a user profile page which pulls in the logged in users information. As you can see I have set up that with the submit button the altered information gets sent to a edit_profile.php I've checked it appears with an echo. Everything arrives except password which i am not sure why.</p>
  
  <p>My question is how do I get the new updated details to update the SQL.</p>
  
  <p>Below is my profile page.</p>
  
  <pre><code>&lt;!-- loads the php file into here --&gt;
  &lt;?php  
  
  /* This script pulls the existing name input and displays it when the user logs in. */
  
  session_start();
  
  include("connection.php");
  
  $query="SELECT * FROM users WHERE id='".$_SESSION['id']."' LIMIT 1";
  
  $result = mysqli_query($link,$query);
  
  $row = mysqli_fetch_array($result);
  
  
  
  
  ?&gt;
  
  
  &lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  &lt;head&gt;
  &lt;meta charset="utf-8"&gt;
  &lt;meta http-equiv="X-UA-Compatible" content="IE=edge"&gt;
  &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt;
  &lt;!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --&gt;
  &lt;title&gt;MyBday&lt;/title&gt;
  
  &lt;!-- Bootstrap --&gt;
  &lt;link href="css/bootstrap.min.css" rel="stylesheet"&gt;
  
  &lt;link href='https://fonts.googleapis.com/css?family=Lato:400,300,100,300italic' rel='stylesheet' type='text/css'&gt;
  
      &lt;link rel="stylesheet" type="text/css" href="resources/css/profilestyles.css"&gt;  
  
  
  &lt;!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --&gt;
  &lt;!-- WARNING: Respond.js doesn't work if you view the page via file:// --&gt;
  &lt;!--[if lt IE 9]&gt;
    &lt;script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"&gt;&lt;/script&gt;
    &lt;script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"&gt;&lt;/script&gt;
  &lt;![endif]--&gt;
  
  
  &lt;/head&gt;
  
  
  
   &lt;body data-spy="scroll" data-target=".navbar-collapse"&gt;
  
   &lt;div class="navbar navbar-default navbar-fixed-top"&gt;
  
   &lt;div class="container"&gt;
  
      &lt;div class="navbar-header"&gt;
  
          &lt;button class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"&gt;
  
              &lt;span class="icon-bar"&gt;&lt;/span&gt;
  
              &lt;span class="icon-bar"&gt;&lt;/span&gt;
  
              &lt;span class="icon-bar"&gt;&lt;/span&gt;
  
          &lt;/button&gt;
  
          &lt;a class="navbar-brand"&gt;MyBday&lt;/a&gt;
  
      &lt;/div&gt;
  
          &lt;div class="collapse navbar-collapse"&gt;
  
  
  
             &lt;form class="navbar-form navbar-right" method="post"&gt;
  
              &lt;ul class="nav nav-pills"&gt;
                &lt;li role="presentation"&gt;&lt;a href="mainpage.php"&gt;My connections&lt;/a&gt;&lt;/li&gt;
                &lt;li role="presentation"&gt;&lt;a href="#"&gt;World connections&lt;/a&gt;&lt;/li&gt;
                  &lt;li role="presentation"  class="active"&gt;&lt;a href="profile.php"&gt;Profile&lt;/a&gt;&lt;/li&gt;    
                &lt;li role="presentation"&gt;&lt;a href="#"&gt;Messages&lt;/a&gt;&lt;/li&gt;
                &lt;li role="presentation"&gt;&lt;a href="index.php?logout=1"&gt;Logout&lt;/a&gt;&lt;/li&gt;
              &lt;/ul&gt;
  
  
              &lt;/form&gt;
  
          &lt;/div&gt;
  
  
      &lt;/div&gt;  
  &lt;/div&gt;
  
  
  
  
      &lt;div class="container"&gt;
      &lt;h1&gt;Edit Profile&lt;/h1&gt;
      &lt;hr&gt;
      &lt;div class="row"&gt;
        &lt;!-- left column --&gt;
         &lt;div class="col-md-3"&gt;
           &lt;div class="text-center"&gt;
        &lt;img src="//placehold.it/100" class="avatar img-circle" alt="avatar"&gt;
        &lt;h6&gt;Upload a different photo...&lt;/h6&gt;
  
        &lt;input class="form-control" type="file"&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  
    &lt;!-- edit form column --&gt;
    &lt;div class="col-md-9 personal-info"&gt;
      &lt;div class="alert alert-info alert-dismissable"&gt;
        &lt;a class="panel-close close" data-dismiss="alert"&gt;×&lt;/a&gt; 
        &lt;i class="fa fa-coffee"&gt;&lt;/i&gt;
        This is an &lt;strong&gt;.alert&lt;/strong&gt;. Use this to show important messages to the user.
      &lt;/div&gt;
      &lt;h3&gt;Personal info&lt;/h3&gt;
  
      &lt;form class="form-horizontal" role="form" action="edit_profile.php" method="post"&gt;
  
        &lt;div class="form-group"&gt;
          &lt;label class="col-lg-3 control-label name"&gt;name:&lt;/label&gt;
          &lt;div class="col-lg-8"&gt;
           &lt;input class="form-control" value="&lt;?php echo $row['name'];?&gt;" type="text" name="name"&gt;
          &lt;/div&gt;
        &lt;/div&gt;
        &lt;div class="form-group"&gt;
          &lt;label class="col-lg-3 control-label"&gt;Email:&lt;/label&gt;
          &lt;div class="col-lg-8"&gt;
            &lt;input class="form-control" value="&lt;?php echo $row['email'];?&gt;" type="text" name="email"&gt;
          &lt;/div&gt;
        &lt;/div&gt;
        &lt;div class="form-group"&gt;
          &lt;label class="col-lg-3 control-label"&gt;DOB:&lt;/label&gt;
          &lt;div class="col-lg-8"&gt;
            &lt;input class="form-control" value="&lt;?php echo $row['DOB'];?&gt;" type="date" name="DOB"&gt;
          &lt;/div&gt;
        &lt;/div&gt;
        &lt;div class="form-group"&gt;
          &lt;label class="col-lg-3 control-label"&gt;Country&lt;/label&gt;
          &lt;div class="col-lg-8"&gt;
            &lt;input class="form-control" value="&lt;?php echo $row['country'];?&gt;" type="text" name="country"&gt;
          &lt;/div&gt;
        &lt;/div&gt;
  
        &lt;div class="form-group"&gt;
          &lt;label class="col-md-3 control-label"&gt;Password:&lt;/label&gt;
          &lt;div class="col-md-8"&gt;
            &lt;input class="form-control" value="&lt;?php echo $row['pasword'];?&gt;" placeholder="At least 8 characters and 1 cap letter" type="password" name="password"&gt;
          &lt;/div&gt;
        &lt;/div&gt;
        &lt;div class="form-group"&gt;
          &lt;label class="col-md-3 control-label"&gt;Confirm password:&lt;/label&gt;
          &lt;div class="col-md-8"&gt;
            &lt;input class="form-control" value="&lt;?php echo $row['pasword'];?&gt;" placeholder="At least 8 characters and 1 cap letter" type="password" name="password"&gt;
          &lt;/div&gt;
        &lt;/div&gt;
        &lt;div class="form-group"&gt;
          &lt;label class="col-md-3 control-label"&gt;&lt;/label&gt;
          &lt;div class="col-md-8"&gt;
            &lt;input class="btn btn-primary" value="Save Changes" type="submit"&gt;
            &lt;span&gt;&lt;/span&gt;
            &lt;input class="btn btn-default" value="Cancel" type="reset"&gt;
          &lt;/div&gt;
        &lt;/div&gt;
  
      &lt;/form&gt;
    &lt;/div&gt;
  </code></pre>
  
  <p>
  </p>
  
  <pre><code>     &lt;!-- jQuery (necessary for Bootstrap's JavaScript plugins) --&gt;
  
  &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"&gt;&lt;/script&gt;
  &lt;!-- Include all compiled plugins (below), or include individual files as needed --&gt;
  &lt;script src="js/bootstrap.min.js"&gt;&lt;/script&gt;
  
  
  
  
  
  
   &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>When the submit button is pressed it takes you to edit_profile.php which is this at the moment.</p>
  
  <pre><code>&lt;?php
  
  session_start();
  
  include("connection.php");
  
  $query="SELECT * FROM users WHERE id='".$_SESSION['id']."' LIMIT 1";
  
  $result = mysqli_query($link,$query);
  
  $row = mysqli_fetch_array($result);
  
  
  
  
  
  
  
  $name= $_POST['name']; echo $name;
  $email= $_POST['email']; echo $email;
  $DOB= $_POST['DOB']; echo $DOB;
  $country= $_POST['country']; echo $country;
  $password= $_POST['password']; echo $password;
  
  
  
  ?&gt;
  </code></pre>
  
  <p>What script am i missing here to update the database. And how do I make sure I don't direct the user to a blank edit_profile.php page</p>
  
  <p>Any help would be much appreciated.</p>