title: How to take user input php
body: <p>I'm making an event management system. I dont know what's wrong, it just keeps reloading after I click <code>submit</code> <code>button</code>. </p>
  
  <p>Here's my <code>HTML</code> codes</p>
  
  <pre><code>&lt;?php 
  session_start(); 
  
  if (!isset($_SESSION['username'])) {
      $_SESSION['msg'] = "You must log in first";
      header('location: login.php');
  }
  
  if (isset($_GET['logout'])) {
      session_destroy();
      unset($_SESSION['username']);
      header("location: login.php");
  }
  
  &lt;div class="header"&gt;
      &lt;h2&gt;Create Event&lt;/h2&gt;
  &lt;/div&gt;
  
  &lt;form method="post" action="create_event.php"&gt;
      &lt;div class="input-group"&gt;
          &lt;label&gt;Event Title&lt;/label&gt;
          &lt;input type="text" name="event_title" &gt;
      &lt;/div&gt;
      &lt;div class="input-group"&gt;
      &lt;label&gt;Pick Location&lt;/label&gt;
          &lt;select name="location"&gt;
              &lt;option&gt;Alabang&lt;/option&gt;
              &lt;option&gt;South City&lt;/option&gt;
              &lt;option&gt;Batangas&lt;/option&gt;
              &lt;option&gt;Cavite&lt;/option&gt;
              &lt;option&gt;Laguna&lt;/option&gt;
          &lt;/select&gt;
      &lt;div class="input-group"&gt;
      &lt;label&gt;Address&lt;/label&gt;
      &lt;textarea rows="4" cols="50" name="address"&gt;&lt;/textarea&gt;
      &lt;/div&gt;
      &lt;div class="date"&gt;
      &lt;label&gt;Pick date and time&lt;/label&gt;
      &lt;input type="date" name="date"&gt;&lt;/br&gt;
      &lt;input type="time" name="time"&gt;
      &lt;/div&gt;
      &lt;div class="event_info"&gt;
          &lt;label&gt;Event Information&lt;/label&gt;
          &lt;textarea rows="4" cols="50" name="event_info"&gt;&lt;/textarea&gt;
      &lt;/div&gt;
      &lt;div class="input-group"&gt;
          &lt;button type="submit" class="btn" name="create_event"&gt;Create Event&lt;/button&gt;
      &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>
  </p>
  
  <p><code>PHP</code> code:</p>
  
  <pre><code>    // Create Event
  if (isset($_POST['create_event'])) {
      // receive all input values from the form
      $event_title = mysql_real_escape_string($_POST['event_title']);
      $location = mysql_real_escape_string($_POST['location']);
      $address = mysql_real_escape_string($_POST['address']);
      $date = mysql_real_escape_string($_POST['date']);
      $time = mysql_real_escape_string($_POST['time']);
      $event_info = mysql_real_escape_string($_POST['event_info']);
      $query="select * from `event` where event_title='$_POST[event_title]' or time='$_POST[time]' or date='$_POST[date]'";
      $result=mysql_query($query);
      $count=mysql_num_rows($result);
      if($count&gt;0)
          {
              array_push($errors, "Already used");
          }
  
  
      // form validation: ensure that the form is correctly filled
      if (empty($event_title)) { array_push($errors, "Please input title"); }
      if (empty($location)) { array_push($errors, "Location is required"); }
      if (empty($address)) { array_push($errors, "Location is required"); }
      if (empty($time)) { array_push($errors, "Time is required"); }
      if (empty($date)) { array_push($errors, "Date is required"); }
      if (empty($event_info)) { array_push($errors, "Date is required"); }
  
  
      // register user if there are no errors in the form
      if (count($errors) == 0) {
          $query = "INSERT INTO `event` (event_title,location,address,time,date,event_info) VALUES ('$event_title', '$location','$address','$time','$date','$event_info')";
  $result = mysql_query($query);
  echo("success");
      }
  
  }
  </code></pre>
  
  <p>I don't think there is anything wrong because if I click the <code>submit</code> <code>button</code>, no errors popup. It just reloads but no data is sent to my database.</p>