问题描述
我想要一个带有4个提交按钮的表单。一旦他们中的任何一个被按下,他们的shell将调用具有不同内容的相同页面。为了确定它是哪一个内容,我将编写一个PHP脚本,但我还没有到。我的问题是,我需要传递值。
I want a form with 4 submit buttons. Once any of them is pressed, they shell call the same page with different content. To determine which content it is, I will write a PHP Script, but I have not come that far yet. My Problem on the way is, that I need to pass the value along.
我在这里找到了我的问题的答案()。我复制并调整了代码,但它不起作用。
当我想用我定义的名称访问$ _POST数组时,它说它是一个未知的索引。这是我迄今为止的相关代码。
I found an answer to my question in here ( Two submit buttons in one form ). I copied and adjusted the code but it is not working.When I want to access the $_POST array with my defined name, it says it is an unknown index. This is my relevant code so far.
<div>
<form action="nutzerverwaltung.php" method="post">
<input type="submit" class="nv_select" name="nv_select" value="Nutzer hinzufuegen" />
<input type="submit" class="nv_select" name="nv_select" value="Nutzer loeschen" />
<input type="submit" class="nv_select" name="nv_select" value="Nutzer bearbeiten" />
<input type="submit" class="nv_select" name="nv_select" value="Alle Nutzer anzeigen" />
</form>
<br />
</div>
<?php if ($_POST["nv_select"] == "Nutzer hinzufuegen") echo "Hallo"; ?>
我做错了什么?
John
推荐答案
也许你想写名字 = nv_select。你忘了平等。当然,名称属性应该是不同的nv_select1,nv_select2等。
Maybe you want to write name = "nv_select". You forget equal. Of course name atributes should be different nv_select1, nv_select2 etc.
这篇关于HTML表单提交按钮不会写入$ _POST的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!