title: How to use timestamp in php
body: <p>I am trying to insert current  time and date of SO-NUMBER which user is inputting. here i am facing problem in IF..ELSE loop,<br>
  its updating only one column in the database i.e "samplerecived" column if i select "qccheck" option also.<br>
  Below is the script for html and php respectively.  </p>
  
  <pre><code>&lt;form id="form1" name="form1" method="post" action="insert.php" &gt;
  &lt;p&gt;
  &lt;lable&gt;ENTER SO NUMBER&lt;/lable&gt;
  &lt;input type="text"  name="soid" id="soid" maxlength="6" required&gt;
  &lt;p&gt;
  &lt;lable&gt;SELECT DEPARTMENT&lt;/lable&gt;
  &lt;select type="text"  name="dept" id="dept"&gt;
  
  &lt;option value="NGS Analysis"&gt;NGS Analysis&lt;/option&gt;
  &lt;option value="E-Array"&gt;E-Array&lt;/option&gt;
  &lt;option value="Micro-Array"&gt;Micro-Array&lt;/option&gt;
  &lt;option value="NGS Data"&gt;NGS Data&lt;/option&gt;
  &lt;/select&gt;
  &lt;/p&gt;
  &lt;p&gt;
  &lt;lable&gt;SELECT STATUS&lt;/lable&gt;
  &lt;select name="options"&gt;
  &lt;option value="Sample Recived" name="samplerecived"&gt;Sample Recived&lt;/option&gt;
  &lt;option value="QC Check" name="qccheck"&gt;QC Check&lt;/option&gt;
  
  &lt;/select&gt;
  &lt;/p&gt;
  &lt;p&gt;&lt;button&gt;&lt;img src="http://brandonmadeawebsite.com/images/art/icons/insert_icon.png"  height="50" /&gt;INSERT&lt;/button&gt;&lt;/p&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>insert.php  </p>
  
  <pre><code>&lt;?php
   $so = $_POST['soid'];
   $dp = $_POST['dept'];
  $selected = $_POST['samplerecived'];
  $selected1 = $_POST['qccheck'];
  
  $servername = "localhost";
  $username = "root";
  $password = "";
  $dbname = "status";
  
  // Create connection
  $conn = new mysqli($servername, $username, $password, $dbname);
  // Check connection
  if ($conn-&gt;connect_errno) {
      printf("Connect failed: %s\n", $conn-&gt;connect_error);
      exit();
  }
  
  if($selected = 1){
  $result = mysqli_query($conn,"INSERT INTO $dbname.statusinfo (soid, dept, samplerecived) VALUES ('$so','$dp',NOW())")or die(mysqli_error($conn));
  
  }
  
  else{
  $result = mysqli_query($conn,"INSERT INTO $dbname.statusinfo (soid, dept,  qccheck) VALUES ('$so','$dp',NOW())")or die(mysqli_error($conn));
  
  }
  echo "Inserted sucessfully with So Number &lt;u&gt;&lt;b&gt;$so&lt;/b&gt;&lt;/u&gt; Corresponding Status is &lt;u&gt;&lt;b&gt;$st&lt;/b&gt;&lt;/u&gt;";
  $conn-&gt;close();
  ?&gt;
  </code></pre>
  
  <p>the output i am getting is<br>
  only "samplerecived" column is updating with current timestamp if user choose "qccheck "also.<br>
  Now i need is, if user selects "qccheck" option in the web page than in database only "qccheck" column should update with current timestamp.<br>
  if user selects "samplerecived" option in the web page than in database only "samplerecived" column should update with current timestamp.  </p>
  
  <p>kindly rectify the problem in script, thanks in advance guys.  </p>