Php 提交按钮:按钮文本与值不同

Php 提交按钮:按钮文本与值不同,php,html,forms,submit,Php,Html,Forms,Submit,我正在用PHP编写一个搜索表单。 我希望用户能够使用以下提交按钮添加搜索字段: <input type="submit" name="fields" value="<?php echo $fields+1 ?>" /> 您可以使用隐藏输入来存储值计数,它将在GET/POST后可用: <input type="submit" name="fields" value="add new field" /> <input type="hidden" name=

我正在用PHP编写一个搜索表单。 我希望用户能够使用以下提交按钮添加搜索字段:

<input type="submit" name="fields" value="<?php echo $fields+1 ?>" />

您可以使用隐藏输入来存储值计数,它将在GET/POST后可用:

<input type="submit" name="fields" value="add new field" />
<input type="hidden" name="fieldsCount" value="<?php echo $fields+1 ?>" />


您可以使用隐藏字段存储或发布
$fields+1
值:

<input type="hidden" name="fields" value="<?php echo $fields+1 ?>" />
<input type="submit" name="submitter" value="Send" />

您可以使用按钮元素:

<button type="submit" name="seven" value="7">Push Me</button>
推我

参考文献:

如果您有多个提交字段,并且每个字段的内部值不同(不可见),每个外部(可见)字段的名称不同,则可能无法工作。与公认的答案相比,这一点要好得多。也许这是一个新的功能,因为这个答案?