如何添加$变量到onclick="location.href='


How to add a $variable to a onclick="location.href='

嗨,我需要帮助,因为这是不工作:我只是想打开带有按钮的网站,但在搜索框.....

<html>
<body>
    <form>
        <input type=button onClick=window.open("action.php","demo","width=550,height=300,left=150,top=200,toolbar=0,status=0,"); value="Öffne">
    </form>
    <form method="post" action="action.php">Suche: <input name="suche" type="text"><br>
        <input type="submit" value="OK">
    </form>
</body>
</html>

<php
$user = $_POST['suche'];
$seite = 'www.google.de/#q=';
$ziel=$seite.$user;

<form>
      <input type=button onclick="location.href='https://www.google.de/#q=<?php echo $seite; ?>'" value='Website'>
      <input type=button onClick="self.close();" value="Close this window">
</form>

你在html标签attr和php关闭标签try上有更多的引号缺失

<html>
<body>
<form>
<input type="button" onClick='window.open("action.php","demo","width=550,height=300,left=150,top=200,toolbar=0,status=0,");' value="Öffne">
</form>
<form method="post" action="action.php">Suche: <input name="suche" type="text"><br>
     <input type="submit" value="OK">
</form>
</body>
</html>
<?php
$user = $_POST['suche'];
$seite = 'www.google.de/#q=';
$ziel=$seite.$user;
?>
<form>
<input type="button" onclick="location.href='https://www.google.de/#q=<?php echo $seite; ?>'" value='Website'>
<input type="button" onClick="self.close();" value="Close this window">
</form>

现在我有最后一个问题,我想把两个文件index.html和action.php在一个文件。所以,如果我去Index.html,我只需要输入我的值为"such"和点击提交按钮("ok"),以保存"name"的值到"$input",然后点击一个按钮谷歌,proxer,....在那些网站上搜索。(也许如果可能的话,我可以合并提交按钮('OK')和按钮(google,proxer,…),使其更干净)

例如google + $input的链接为:$seite_google.$input;

我的代码现在看起来像:

为index . php:

 <?php
   $input = $_POST['suche'];
    $seite_google = 'https://www.google.de/#q=';
    $seite_myanimelist = 'http://myanimelist.net/anime.php?q=';
    $seite_anisearch = 'http://de.anisearch.com/anime/index/?char=all&text=';
    $seite_proxer = 'http://proxer.me/search?name=';
    ?>
    <form>
    <input type="button" onclick="location.href='<?php echo $seite_google.$input; ?>'" value='Google Suche'>
    <input type="button" onclick="location.href='<?php echo $seite_myanimelist.$input; ?>'" value='MyAnimeList'>
    <input type="button" onclick="location.href='<?php echo $seite_anisearch.$input; ?>&q=true'" value='AniSearch'>
    <input type="button" onclick="location.href='<?php echo $seite_proxer.$input; ?>&sprache=alle&typ=all&genre=&nogenre=&sort=name&length=&length-limit=down#search'" value='Proxer'>
    </form>
    <html>
    <body>
    <form method="post" action="">Suche: <input name="suche" type="text"><br>
         <input type="submit" value="OK" name="submit">
    </form>
    </body>
    </html>