title: Simple php - mysql select and insert
body: <p>I am not a programmer (duh), I just need to make a really simple tool for populating sql database. First I have html with form:</p>
  <pre><code>&lt;form action=&quot;http://localhost:8081/phpSearch.php&quot; method =&quot;post&quot;&gt;
  Enter code: &lt;input type=&quot;text&quot; name=&quot;search&quot;&gt;&lt;br&gt;
  &lt;input type =&quot;submit&quot;&gt;
  &lt;/form&gt;
  </code></pre>
  <p>and then php that should connect to MYSQL, search for data according to input (code,name) in one table and then populate another table with the result. And I'm only mising what to put instead of question marks.</p>
  <pre><code>&lt;?php
  $search1 = $_POST['search'];
  
  $servername = &quot;localhost&quot;;
  $username = &quot;root&quot;;
  $password = &quot;&quot;;
  $dbname = &quot;mydb&quot;;
  
  $conn = new mysqli($servername, $username, $password, $dbname);
  
  $sql = &quot;SELECT code,name FROM users WHERE code LIKE '%$search1%'&quot;;
  
  $sql2 = &quot;INSERT INTO newUsers (newCode,newName) VALUES ('$search1', ??????)&quot;;
  
  $conn-&gt;close();
  ?&gt;
  </code></pre>
  <p>I'm pretty sure this is easy for you experts, so thanks in advance.</p>