所以我有五个成员变量,但不是写:
if(isset($_POST['member1'])) {
$member1 = mysqli_escape_string($mysqli, $_POST['member1']);
} else {
$member1= '';
}
对于所有成员(没有错误),我想做一个 for 循环,但每次我运行循环时:
for($i = 1; $i <= 5; $i++) {
if(isset($_POST['member . $i'])) {
$member . $i = mysqli_escape_string($mysqli, $_POST['member . $i']);
} else {
$member . $i = '';
}
}
我收到此错误:
Notice: Undefined variable: member
五次。我究竟做错了什么?