title: How to add a $variable to a onclick="location.href='
body: <p>Hi i need help because this is not working:
  I just wanted to open websites with buttons but in a search box.....</p>
  
  <pre><code>&lt;html&gt;
  &lt;body&gt;
      &lt;form&gt;
          &lt;input type=button onClick=window.open("action.php","demo","width=550,height=300,left=150,top=200,toolbar=0,status=0,"); value="Öffne"&gt;
      &lt;/form&gt;
      &lt;form method="post" action="action.php"&gt;Suche: &lt;input name="suche" type="text"&gt;&lt;br&gt;
          &lt;input type="submit" value="OK"&gt;
      &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  
  
  &lt;php
  $user = $_POST['suche'];
  $seite = 'www.google.de/#q=';
  $ziel=$seite.$user;
  
  
  
  &lt;form&gt;
        &lt;input type=button onclick="location.href='https://www.google.de/#q=&lt;?php echo $seite; ?&gt;'" value='Website'&gt;
        &lt;input type=button onClick="self.close();" value="Close this window"&gt;
  &lt;/form&gt;
  </code></pre>