title: Fetching data from MySQL database using PHP, Displaying it in a form for editing
body: <p>I'm a newbie to this and wrote the code below to fetch user data from a MySQL Database and display it in a form for editing and saving. Problem is, it does not work. Any help will be appreciated.</p>
  
  <pre><code>&lt;html&gt;
      &lt;head&gt;
          &lt;title&gt; Delegate edit form&lt;/title&gt;
      &lt;/head&gt;
      &lt;body&gt;
          Delegate update form  &lt;p&gt;
              &lt;?php
              $usernm   = "root";
              $passwd   = "";
              $host     = "localhost";
              $database = "swift";
  
              //$Name=$_POST['Name'];
              //$Username=$_POST['User_name'];
              //$Password=$_POST['Password'];
  
              mysql_connect($host,$usernm,$passwd);
  
              mysql_select_db($database);
  
              $sql    = "SELECT * FROM usermaster WHERE User_name='$Username'";
              $result = mysql_query($sql) or die(mysql_error());
              while ($row    = mysql_fetch_array($result))
              {
  
                  $Name     = $row['Name'];
                  $Username = $row['User_name'];
                  $Password = $row['User_password'];
              }
              ?&gt;
          &lt;form action="Delegate_update.php" method="post"&gt;
              Name
              &lt;input type="text" name= "Name" value= "&lt;?php echo $row ['Name']; ?&gt; "size=10&gt;
              Username
              &lt;input type="text" name= "Username" value= "&lt;?php echo $row ['Username']; ?&gt; "size=10&gt;
              Password
              &lt;input type="text" name= "Password" value= "&lt;?php echo $row ['Password']; ?&gt;" size=17&gt;
              &lt;input type="submit" name= "submit" value="Update"&gt;
          &lt;/form&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>