title: PHP update profile works fine on local host when hosted on server stop works
body: <p>I have my PHP code working on my localhost perfectly fine but once i have uploaded the page to a server it comes out differently, can anyone suggest whats the problem</p>
  
  <p>I shouldn't be getting the fields with this bit of code in it:<code>&lt;?=$firstname?&gt;</code> </p>
  
  <p>here is the link to the page I am talking about:</p>
  
  <p>[<a href="http://studentnet.kingston.ac.uk/k1003140/user1.php]" rel="nofollow">http://studentnet.kingston.ac.uk/k1003140/user1.php]</a></p>
  
  <p>Here is the code:</p>
  
  <pre><code>&lt;?php
  session_start();
  
  if(isset($_SESSION["username"])){
      header("location: user1.php"+$u);
  } else {
      header ("location: index.php");
  }
  // see if the form has been completed
  include_once("php_includes/check_login_status.php");
  include_once("php_includes/db_conx.php");
  // Initialize any variables that the page might echo
  $u = "";
  $firstname = "";
  $surname = "";
  $gender = "Male";
  $country = "";
  $weight = "";
  $height = "";
  
  if(isset($_GET["u"])){
      $u = preg_replace('#[^a-z0-9]#i', '', $_GET['u']);
  } 
  
  $sql = "SELECT * FROM users WHERE username='$u' AND activated='1' LIMIT 1";
  $user_query = mysqli_query($db_conx, $sql);
  
  // check if the user exists in the database
  while ($row = mysqli_fetch_array($user_query, MYSQLI_ASSOC)) {
      $firstname = $row["firstname"];
      $surname = $row["surname"];
      $weight = $row["weight"];
      $height = $row["height"];
      $email = $row["email"];
      $gender = $row ["gender"];
  }
  if (isset($_POST['submit'])){
      $firstname = $_POST['firstname'];
      $surname = $_POST['surname'];
      $weight = $_POST['weight'];
      $height = $_POST['height'];
      $email = $_POST['email'];
      $gender = $_POST['gender'];
      mysql_connect ("studentnet","k1003140","k1003140"); mysql_select_db('db_k1003140');     
      // check if that user exist 
      $exists = mysql_query ("SELECT * FROM users WHERE firstname='" . $firstname . "'") or die ("query cant connect");   
      if (mysql_num_rows ($exists) != 0) {
      // update the description in the database       
          mysql_query("UPDATE users SET firstname='$firstname', surname='$surname', weight='$weight', height='$height' WHERE firstname='$firstname'") or die ("update could not be applied");
              echo "successful";
      } else echo "the name does not exist";  
  }
  ?&gt;  
  </code></pre>
  
  <p>Here is the PHP of my code</p>
  
  <pre><code>    &lt;!DOCTYPE html&gt;
      &lt;html&gt;
      &lt;head&gt;
          &lt;title&gt;update MySql form&lt;/title&gt;
      &lt;/head&gt;
          &lt;body&gt;
          &lt;div id="pageMiddle"&gt;  
  
              &lt;form action="user1.php" method="POST"&gt;
                  &lt;div&gt;
                  &lt;p&gt;First Name: &lt;input type="text" name="firstname" id="firstname" value="&lt;?=$firstname?&gt;"&gt;&lt;/p&gt;
                  &lt;p&gt;Surname: &lt;input type="text" name="surname" id="surname" value="&lt;?=$surname?&gt;"&gt;&lt;/p&gt;   
                  &lt;p&gt;Weight: &lt;input type="text" name="weight" id="weight" value="&lt;?=$weight?&gt;"&gt;&lt;/p&gt;
                  &lt;p&gt;Height: &lt;input type="text" name="height" id="height" value="&lt;?=$height?&gt;"&gt;&lt;/p&gt;
                  &lt;p&gt; &lt;input type="submit" name="submit" id="submit" value="Update Description"&gt;&lt;/p&gt;
                  &lt;/div&gt;
              &lt;/form&gt;
          &lt;/body&gt;
      &lt;/html&gt; 
  </code></pre>
  
  <p>Can anyone suggest how i can make user to edit their detail with $u not firstname because if anyone has the same name will be changing the other users detail, also is this safe or can anyone update anyone's detail. </p>