Php $\u GET[';name';])正在获取输入name=';名称';无足轻重
$\u GET['name']->这行代码未按预期工作 HTML+PHP在一个文件中Php $\u GET[';name';])正在获取输入name=';名称';无足轻重,php,html,Php,Html,$\u GET['name']->这行代码未按预期工作 HTML+PHP在一个文件中 在您的php代码中,您需要在$\u GET['name']上放置一个isset,然后您的代码将如下所示: <?php if (isset($_GET['update'])) { updateEmployee(); } function updateEmployee() { global $newName; if(isset($_GET['name'])) {
在您的php
代码中,您需要在$\u GET['name']
上放置一个isset,然后您的代码将如下所示:
<?php
if (isset($_GET['update']))
{
updateEmployee();
}
function updateEmployee()
{
global $newName;
if(isset($_GET['name']))
{
$newName = $_GET['name']; //this line is not working
}
}
?>
尝试上述解决方案将帮助您您可以在$\u GET['name']
上使用isset函数$\u GET['name']在$\u GET['update']上使用检查是否存在name
参数byisset($\u GET['name'])
。我已经检查了name
参数是否存在($\u GET['name'])其中$newName
的值没有什么问题,那么代码有什么问题,为什么不获取输入类型的值name='name'
?现在执行您建议的代码时没有错误,但是变量“$newName”的值没有什么问题为什么?
<?php
if (isset($_GET['update']))
{
updateEmployee();
}
function updateEmployee()
{
global $newName;
if(isset($_GET['name']))
{
$newName = $_GET['name']; //this line is not working
}
}
?>