Not able to fetch $fnamef and $lnamel from form!!!
提供帮助 这是我的代码: 我从数组中的表单中获取值作为成员团队,并希望将其存储在数据库中
$fname=$_REQUEST['name'];
$lname=$_REQUEST['last'];
$cnct=$_REQUEST['ph'];
$email=$_REQUEST['email'];
$sem=$_REQUEST['semester'];
$dept=$_REQUEST['dept'];
$event=$_REQUEST['event'];
$tno=$_REQUEST['tno'];
$tname=$_REQUEST['namet'];
$fnamef=array();
$lnamel=array();
for($m=0;$m<$tno;$m++)
{
$fnamef[$m]=$_REQUEST['f'.($m+1)];
$lnamel[$m]=$_REQUEST['l'.($m+1)];
}
for($m=0;$m<$tno;$m++)
{
echo $fnamef[$m];
echo $lnamel[$m];
}
echo $tname;
echo $tno;
echo $fname;
echo $lname;
?>
答案 0 :(得分:0)
我不确定它是什么,所以我无法解释它,但根据您的意见这里是解决方案,并提到我在此代码中已更改的内容:
$fname=$_REQUEST['name'];
$lname=$_REQUEST['last'];
$cnct=$_REQUEST['ph'];
$email=$_REQUEST['email'];
$sem=$_REQUEST['semester'];
$dept=$_REQUEST['dept'];
$event=$_REQUEST['event'];
$tno=$_REQUEST['tno'];
$tname=$_REQUEST['namet'];
$fnamef=array();
$lnamel=array();
for($m=0;$m<$tno;$m++)
{
$fnamef[$m] = 'f'.($m+1); // only change this part
$lnamel[$m] = 'l'.($m+1); // only change this part
}
for($m=0;$m<$tno;$m++)
{
echo $fnamef[$m] . "<br>";
echo $lnamel[$m] . "<br>";
}
echo $tname . "<br>";
echo $tno . "<br>";
echo $fname . "<br>";
echo $lname . "<br>";