title: How to select value get in php form from mysql for update the data
body: <p>I am getting the value of already selected option from the database mysql through php. title and post value i got the right from the database on the current $id but the value of selected box not showing what is already selected please help me to get rid of this error</p>
  
  <pre><code>&lt;?php
  $servername = "localhost";
  $username = "root";
  $password = "";
  $dbname = "alurdu_db"; 
  $id = $_GET['id'];
  mysql_query('SET CHARACTER SET utf8'); 
  $conn = new mysqli($servername, $username, $password, $dbname);
  if ($conn-&gt;connect_error) {    die("Connection failed: " .$conn-&gt;connect_error);
  }
  $sql = "SELECT * FROM news WHERE news_id='$id'";
  $result = $conn-&gt;query($sql);
   if ($result-&gt;num_rows &gt;0) {
     while($row = $result-&gt;fetch_assoc()) {  
    echo '&lt;form action="up.php" method="post" enctype="multipart/form-data"&gt;';
    echo '&lt;div class="form-group"&gt;';
    echo '&lt;input type="text" class="form-control" name="news_title" value="' . $row["title"] . '"&gt;';
    echo '&lt;select dir="ltr" style="text-align: center;" class="form-control" name="news_cat"&gt;';
    echo '&lt;option value="National" if($row["news_cat"] == "National") echo "selected";&gt;National&lt;/option&gt;';
    echo '&lt;option value="International" if($row["news_cat"] == "International") echo "selected";&gt;International&lt;/option&gt;';
    echo '&lt;/select&gt;';
    echo '&lt;/form&gt;'
  }
  
  } else {
  echo "Wrong Page";
  }
  $conn-&gt;close();
  ?&gt;
  </code></pre>