php - 如何在php中提交表单中获取passport_mrz1值?
问题描述
我已经提交了带有 passport_mrz1 和 passport_mrz2 值的表格,如何获取 passport_mrz1 值?
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
</head>
<body>
<h1>Passport Input</h1>
<form action="" method="post" accept-charset="UTF-8">
<label>passport_mrz1:
<input name="passport_mrz1" type="text" value="P<USAWILLIAMS<<JUSTIN<<<<<<<<<<<<<<<<<<<<<<<" /></label>
<br/>
<label>passport_mrz2
<input name="passport_mrz2" type="text" value="99003853<1USA1101018M1207046110101111<<<<<94"/></label>
</br>
<input type="submit" value="submit this form" />
</form>
</body>
</html>
解决方案
您可以使用POST
方法将数据传递给PHP
脚本。单击按钮时,我添加按钮名称clicked
以执行发布条件。
?php
if (isset($_POST['clicked'])) {
echo $_POST['passport_mrz1'];
}
?>
HTML是:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
</head>
<body>
<h1>Passport Input</h1>
<form action="" method="post" accept-charset="UTF-8">
<label>passport_mrz1:
<input name="passport_mrz1" type="text" value="P" ><USAWILLIAMS<<JUSTIN<<<<<<<<<<<<<<<<<<<<<<<" /></label>
<br/>
<label>passport_mrz2
<input name="passport_mrz2" type="text" value="99003853<1USA1101018M1207046110101111<<<<<94"/></label>
</br>
<input type="submit" value="submit this form" name="clicked" />
</form>
</body>
推荐阅读
- c - 从链表中删除项目
- java - 递归地最小化塔之间的最大差异
- listview - 根据 xamarin 中的 api 响应在列表视图中填充数据
- javascript - window.removeEventListener 在 componentWillUnmount 上不起作用
- python - 在 Pandas、int 和 str 中创建新列时遇到问题
- duktape - 如何在 Duktape 2.5.0 中使用超时来防止 JavaScript 循环等
- r - 如何使用 effect() 函数提取多个变量的边际均值?
- php - 使用 PHP 访问特定的 JSON 对象值
- java - Kafka生产者未来超时
- javascript - 仅在当前元素上更改类(jQuery+this)