title: PHP submit form to another page, and run the method
body: <p>I have 2 php file : a.php and b.php</p>
  
  <p>i want to submit data from a.php to b.php. But i tried, not run in b.php. (i want to run "search" method in b.php after input in a.php).</p>
  
  <p>Thanks</p>
  
  <p>Here is my code</p>
  
  <p>a.php   </p>
  
  <pre><code>&lt;form action="b.php" name="form1" method="post" &gt;
  &lt;input type="search" name="search" id="search" &gt;
  &lt;input type="submit" value=" "&gt;&lt;/form&gt; 
  </code></pre>
  
  <p>b.php</p>
  
  <pre><code>&lt;form id="form1" name="form1" method="post" action="" &gt;
  &lt;input type="search" value="&lt;?php echo $_POST['search'];?&gt;" name="search"&gt;
  &lt;input type="submit" name="cari" value=" "&gt;&lt;/form&gt;
  &lt;?php $search = $_POST['search']; $cari = $_POST['cari']; if($cari){
  if($search != "") { $query = "SELECT  * FROM kondef where poin
  like'%$search%' or deskripsi like '%$search%'"; $result =   $db&gt;
  query($query);}  else { die (mysql_error()); }while($row = $result- 
  fetchArray()) {?&gt;&lt;tr&gt;   &lt;td&gt;&lt;?php echo $row['poin'];?&gt;&lt;/td&gt;&lt;td&gt;&lt;?php echo 
  $row['deskripsi'];?&gt;&lt;/td&gt;&lt;td&gt;&lt;?php echo $row['link'];?&gt;&lt;/td&gt;&lt;/tr&gt;&lt;?php } ?&gt;
  &lt;/table&gt;
  </code></pre>