title: how i can call the button inside the if statement PHP
body: <p>I am a newbie I am having a little problem on how can i call the button inside my if statement. I am trying to work on a userlog where when you click a button it will output on the user log.</p>
  
  <p>but how can i call the >>
  THE VIEW button inside my if statement so that it will <code>fwrite</code> inside the userlog.txt.</p>
  
  <p>inside this <code>if($_POST['submit'] = ")</code> same goes in the search button and the add edit delete button. did u get my point?</p>
  
  <pre><code>&lt;body background="images.jpg"&gt;
  &lt;?php
  session_start();
  
  if($_SESSION['username'])
  {
  echo "Welcome, ".$_SESSION['username']."!&lt;br&gt;&lt;a href='logout.php'&gt;Logout&lt;/a&gt;&lt;br&gt;";
  echo '&lt;FORM METHOD="LINK" ACTION="mydata4.php"&gt;
  &lt;INPUT TYPE="submit" VALUE="Edit/Delete/add"&gt;
  &lt;/FORM&gt;';
  echo '&lt;FORM METHOD="LINK" ACTION="mydata2.php"&gt;
  &lt;INPUT TYPE="submit" VALUE="View" id="viewbutton"&gt;
  &lt;/FORM&gt;';
  echo '&lt;FORM METHOD="LINK" ACTION="display_data.php"&gt;
  &lt;INPUT TYPE="submit" VALUE="Search"&gt;
  &lt;/FORM&gt;';
  }
  else
  {
  die("You must be logged in!");
  }
  
  
  if($_POST['submit'] = ")
  {   
  $date=date("Y-m-d H:i:s");
  $updatefile = "userlogs.txt";
  $fh = fopen($updatefile, 'a') or die("can't open file");
  $stringData = "User: $username click view button";
  fwrite($fh, "$stringData".PHP_EOL);
  fclose($fh);
  }   
  ?&gt;
  </code></pre>