如何使用 PHP 获取隐藏字段值

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2729714/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 07:30:02  来源:igfitidea点击:

How to grab a hidden fields value using PHP

phphtmlpostformshttp-post

提问by TaG

I was wondering how can I grab the value from a hidden field using PHP?.

我想知道如何使用 PHP 从隐藏字段中获取值?

Here is the hidden field.

这里是隐藏字段。

<input type="hidden" name="delete" value="' . $row['delete_id'] . '" />

回答by o0'.

exactly like a non-hidden value.

就像一个非隐藏值。

$_POST["delete"]

回答by Rob

I assume the hidden field is in a form. So give it an id and do it like you normally would get the value from an input field

我假设隐藏字段是一种形式。所以给它一个 id 并像往常一样从输入字段中获取值

$_POST["delete"]

回答by nik

Like this: $_REQUEST['delete']

像这样: $_REQUEST['delete']

回答by cosy

if you use post method use $_POST['delete']; if you use get method use $_GET['delete']; Or for both method use $_REQUEST['delete'];

如果你使用 post 方法使用 $_POST['delete']; 如果你使用 get 方法使用 $_GET['delete']; 或者对于这两种方法都使用 $_REQUEST['delete'];