Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/297.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何将$变量添加到onclick=";location.href=';_Php_Html_Button - Fatal编程技术网

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

Php 如何将$变量添加到onclick=";location.href=';,php,html,button,Php,Html,Button,嗨,我需要帮助,因为这不起作用: 我只想用按钮打开网站,但在搜索框中 <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>

嗨,我需要帮助,因为这不起作用: 我只想用按钮打开网站,但在搜索框中

<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,我只需输入'suche'的值,然后单击submit按钮('ok')将'name'的值保存到'$input'中,然后单击其中一个按钮google、proxer,。。。。在那个网站上搜索。 (如果可能的话,我可以合并submit btton('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>


我不明白这个问题。请你更详细地解释一下你想要达到什么目标,以及到目前为止你做了什么?谢谢我糟糕的解释。。。我把我最近的问题和我到目前为止所做的事情写在这个主题的底部,提前谢谢。)请向上投票或接受您认为有帮助的答案OK,我接受了答案谢谢您的帮助,但我还有一个问题,如果您能帮助我,我将非常感谢…我将我的问题作为答案写在这个主题的底部,如果您能看一下,请…)那么你有什么问题呢?代码运行起来没有问题。现在,我想将index.html和action.php合并到一个文件(html或php)中,这样index.html就不必打开action.php.Man了,但是否可以在一个页面上显示这两个表单,而不是只需在textlabel('suche')中输入文本,然后单击其中一个按钮即可开始搜索(例如在谷歌上)?嗯,它不起作用,我删除了if行和else行,但它只显示了第一个带有一个按钮的表单(不是带有4个按钮的表单)?:D它的工作方式gggggg…最后一个问题是,我是否可以删除submit按钮('OK'),然后使用其他按钮将name=“suche”的值输入到$input中?谢谢你:)