title: PHP post request from HTML page showing blank input fields
body: <p>Currently looking to implement functionality to edit details in MySQL database via a HTML page. The page itself shows all data in the database which matches the unique id of the user who is is logged in via a PHP session and echos that data to input boxes in a while loop. </p>
  
  <p>When the user makes changes to the input text and hits the save changes link it then calls the edit endpoint which in turn calls the edit SQL function in a functions file.</p>
  
  <p>I'm using an anchor tag wrapped in a button to send the id of the row that is being edited and all this sits inside a POST action form.</p>
  
  <p>However the input texts are only showing as blank as if the endpoint is not receiving the text in the input field, and despite trying quite a few different methods I can't seem to get a result.</p>
  
  <p>Code for Web page (not whole page but only concerned code)</p>
  
  <pre><code>    &lt;?php
      $connect =mysqli_connect('localhost','root','','micaddy');
      $id_query = mysqli_query($connect, "SELECT unique_id FROM users WHERE email = '{$_SESSION['login_user']}'");
      $id_array = mysqli_fetch_assoc($id_query);
      $uid = $id_array['unique_id'];
  
      $result = mysqli_query($connect, "SELECT * FROM clubs WHERE user_id = 
      '$uid'");
  
      ?&gt;
      &lt;div class="container"&gt;
      &lt;div class="row"&gt;
          &lt;div class="col-md-12"&gt;
              &lt;div class="panel panel-default"&gt;
                  &lt;div class="panel-heading clearfix"&gt;&lt;h3 class="panel-title"&gt;&lt;strong&gt;Your Golfbag&lt;/strong&gt;&lt;button type="button" class="btn btn-info btn-lg pull-right" data-toggle="modal" data-target="#addModal"&gt;Add Club&lt;/button&gt;&lt;/h3&gt;&lt;/div&gt;
                  &lt;?php while($row=mysqli_fetch_assoc($result)):?&gt;
                  &amp;nbsp &lt;span&gt;&lt;?php if(isset($_SESSION['message'])){ echo $_SESSION['message']; unset($_SESSION['message']);} ?&gt;&lt;/span&gt;
                      &lt;div class="panel-body"&gt;
                          &lt;div class="container-fluid"&gt;
                              &lt;div class="row"&gt;
                                  &lt;div class="col-md-5"&gt;
                                      &lt;div class="panel panel-default"&gt;
                                          &lt;div class="panel-heading"&gt;&lt;h3 class="panel-title"&gt;&lt;strong&gt;&lt;?php echo $row['club_type'];?&gt;&lt;/strong&gt;&lt;/h3&gt;&lt;/div&gt;
                                              &lt;div class="panel-body"&gt;
                                              &lt;form id="" method="POST" action="editClub.php"&gt;
                                                  &lt;div class="form-group"&gt;
                                                  &lt;label for="clubType"&gt;Club ID&lt;/label&gt;
                                                      &lt;input type="text" readonly="" class="form-control" id="inputClubType" value="&lt;?php echo $row['id'];?&gt;" name="clubIdInput"&gt;
                                                  &lt;/div&gt;
                                                  &lt;div class="form-group"&gt;
                                                      &lt;label for="clubBrand"&gt;Type&lt;/label&gt;
                                                      &lt;input type="text" class="form-control" id="inputclubBrand" value="&lt;?php echo $row['club_type'];?&gt;" name="clubTypeInput"&gt;
                                                  &lt;/div&gt;
                                                  &lt;div class="form-group"&gt;
                                                      &lt;label for="clubBrand"&gt;Brand&lt;/label&gt;
                                                      &lt;input type="text" class="form-control" id="inputclubBrand" value="&lt;?php echo $row['brand'];?&gt;" name="clubBrandInput"&gt;
                                                  &lt;/div&gt;
                                                  &lt;div class="form-group"&gt;
                                                      &lt;label for="clubNum"&gt;Number or Type&lt;/label&gt;
                                                      &lt;input type="text" class="form-control" id="inputclubNum" value="&lt;?php echo $row['club_number'];?&gt;" name="clubNumInput"&gt;
                                                  &lt;/div&gt;
                                                  &lt;div id="deleteClub"&gt;
                                                      &lt;button id="submitChange" type="button" class="btn btn-danger btn-lg"&gt;&lt;?php echo "&lt;a href='deleteClub.php?id=".$row['id']."'&gt;Delete&lt;/a&gt;" ?&gt;&lt;/button&gt;
                                                      &lt;button type="button" class="btn btn-info btn-lg"&gt;&lt;?php echo "&lt;a href='editClub.php?id=".$row['id']."'&gt;Save Changes&lt;/a&gt;" ?&gt;&lt;/button&gt;
                                                  &lt;/div&gt;
                                                  &lt;span&gt;&lt;?php if(isset($_SESSION['message'])){ echo $_SESSION['message']; unset($_SESSION['message']);} ?&gt;&lt;/span&gt;
                                                  &lt;/form&gt;
                                              &lt;/div&gt;
                                      &lt;/div&gt;
                                  &lt;/div&gt;
                                  &lt;div class="col-md-5"&gt;
                                      &lt;div class="panel panel-default"&gt;
                                          &lt;div class="panel-heading"&gt;&lt;h3 class="panel-title"&gt;&lt;strong&gt;Club Image&lt;/strong&gt;&lt;/h3&gt;&lt;/div&gt;
                                              &lt;div class="panel-body"&gt;
                                                      &lt;div class="form-group"&gt;
                                                          &lt;img src="club_images/&lt;?php echo $row['clubImg']; ?&gt;" class="img-rounded" width="250px" height="250px" alt="Image"/&gt;
                                                      &lt;/div&gt;
                                              &lt;/div&gt;
                                      &lt;/div&gt;
                                  &lt;/div&gt;
                              &lt;/div&gt;
                          &lt;/div&gt;
                          &lt;span&gt;&lt;?php if(isset($_SESSION['message'])){ echo $_SESSION['message']; unset($_SESSION['message']);} ?&gt;&lt;/span&gt;
                      &lt;/div&gt;
                  &lt;?php endwhile;?&gt;
  
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;     
  </code></pre>
  
  <p>The edit endpoint: </p>
  
  <pre><code>&lt;?php
  session_start();
  $error='';
  
  require_once '../include/DB_Functions.php';
  $db = new DB_Functions();
  
      if(empty($_POST['clubBrandInput']) || empty($_POST['clubNumInput'])){
          $_SESSION['message'] = "Warning: Some fields are blank! Please try again";
          header("Location: golfbag.php");
      } else{
  
          if(isset($_POST['clubBrandInput']) &amp;&amp; isset($_POST['clubTypeInput']) &amp;&amp; isset($_POST['clubNumInput'])){
  
          $brand = $_POST['clubBrandInput'];
          $type = $_POST['clubTypeInput'];
          $num = $_POST['clubNumInput'];
  
          $id = $_GET['id'];
  
          $club = $db-&gt;editclub($brand, $type, $num, $id);
              if($club) {
                      header("Location: golfbag.php");
                      $_SESSION['message'] = "Success! Details edited.";
                  }else{
                      header("Location: golfbag.php");
                      echo $error;
                  }           
          }
      }
  
  ?&gt;
  </code></pre>
  
  <p>The function method:</p>
  
  <pre><code>public function editClub($brand, $type, $num, $id){
  
  $stmt = $this-&gt;conn-&gt;prepare("UPDATE clubs SET brand = '$brand', club_type = '$type', club_number = '$num' WHERE id = '$id'");
  $result = $stmt-&gt;execute();
  $stmt-&gt;close();
  
  if($result){
      $stmt = $this-&gt;conn-&gt;prepare("SELECT * FROM clubs WHERE user_id = ?");
      $stmt-&gt;bind_param("s", $uid);
      $stmt-&gt;execute();
      $club = $stmt-&gt;get_result()-&gt;fetch_assoc();
      $stmt-&gt;close();
  
      return $club;
  }else{
      return false;
  }
  }
  </code></pre>