title: Notice: Undefined offset: 2 in
body: <p>I would like a help, I converted the input string from date to array and if I do not input for example 05/26/2019, all 3 fields did an explode to flip an array, then this error occurs. what can I do?</p>
  
  <p>escola.php</p>
  
  <pre><code> &lt;form method="POST" class="PesquisarData"&gt;
      &lt;h5&gt;Pesquisar Data:&lt;/h5&gt;
      &lt;input type="text" id="data" name="data" class="selectData"&gt;
      &lt;input type="submit" value="Pesquisar" class="buttonData"&gt;&lt;br/&gt;
   &lt;/form&gt;
  
  if (!empty($_POST['data'])) {
          $_POST['disciplina'] = "";
          $_POST['professor'] = "";
  
          $data = explode('/', addslashes($_POST['data']));
          $data = $data[2].'-'.$data[1].'-'.$data[0];
          $sqlm = "SELECT * FROM {$pfx}Material WHERE Data LIKE CONCAT('%',?,'%') ORDER BY Data DESC";
          $qrym = $conn-&gt;prepare($sqlm);
          $qrym-&gt;bindParam(1, $data);
          $qrym-&gt;execute() or die('Ocorreu um erro em uma operação do banco de dados: VL0002.2');
  }
  </code></pre>