我尝试创建一个语言选择页面,但是在提交 id="image" name="image" 的“值”参数时没有通过,而是在 $_POST 中获得了 image_x 和 image_y 值。
这是我的代码:
session_start();
include("languages.php");
function lng($which)
{
global $ARRXKS;
return $ARRXKS[$_SESSION['lang']]["$which"];
}
function LangChoose()
{
echo('
<!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>Meet-Helmond.nl SMS Service - Select your Language</title>
<link href="css.css" rel="stylesheet" type="text/css" />
</head>
<div class="information">
<div class="boxinfo">Cookies MUST be enabled to use this website!</div>
<p>
<form id="loginForm" name="loginForm" method="post" action="index.php">');
echo('<BR />');
print_r($_POST);
echo('<BR />');
global $ARRXKS;
$LANG_keys = array_keys($ARRXKS);
$count = 1;
for ($i = 0; $i <= count($ARRXKS) - 1; $i++)
{
echo('<input type="image" src="images/flags/'.$LANG_keys[$i].'.png" name="image" id="image" value="'.$LANG_keys[$i].'">');
if((($count) % 5) == 0)
{
echo('<BR />');
}
$count = $count + 1;
}
echo('
</form>
</div>
<body>
</body>
</html>
');
}
//print_r($_POST);
if(!isset($_SESSION['lang']))
{
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
if(isset($_POST['image']))
{
if (array_key_exists($_POST['image'], $ARRXKS))
{
$_SESSION['lang'] = $_POST['image'];
}
else
{
LangChoose();
exit();
}
}
else
{
LangChoose();
exit();
}
}
else
{
LangChoose();
exit();
}
}
所以当我检索它时,它没有检测到我选择了哪种语言,我怎样才能正确提交点击图像的值?