我有两个步骤注册表单。从第一步开始,我将获取电子邮件和用户名,从第二步开始,我想获取名字和姓氏并将其添加到数据库中。但问题是我从第一种POST
形式获得的变量,$bridge_username
确切地说,在下面的 IF 语句中不可用(从底部开始的第一个)。问题是它们在其他任何地方都可见,但不在此特定IF
语句中。我已经尝试了一切,包括会话。我可以清楚地看到该变量仍然存在(使用vardump
或只是echo
将其取出),无处不在,但不是我需要它的地方......我很高兴听到你的建议。
$bridge_email = $_POST['email'];
$bridge_username = $_POST['username'];
$bridge_pass = $_POST['password'];
$bridge_pass_conf = $_POST['passconf'];
$bridge_terms = $_POST['terms'];
$bridge_pass_counted = strlen($bridge_pass);
$bridge_username_counted = strlen($bridge_username);
if (isset ($_POST['email']) AND isset ($_POST['password']) AND isset ($_POST['passconf']) AND isset ($_POST['username'])) {
if ($bridge_email != '' AND $bridge_pass != '' AND $bridge_pass_conf != '' AND $bridge_username != '' AND $bridge_terms != '') {
if ($bridge_pass == $bridge_pass_conf) {
if ($bridge_pass_counted >= 33 OR $bridge_pass_counted <= 5) {
} else {
if ($bridge_username_counted >= 65 OR $bridge_username_counted <= 3) {
} else {
if (is_numeric(substr($bridge_username, 0, 1))) {
} else {
//CHECK IF USERNAME OR EMAIL ALREADY EXIST
$checkreguser = $mysqli->query("SELECT username FROM `engine_users` WHERE username = '$bridge_username' OR email = '$bridge_email' LIMIT 0, 1 ");
$checkreguser = $checkreguser->fetch_assoc();
if ($checkreguser == '') {
//CREATING A NEW USER
$mysqli->query("INSERT INTO `users` (`id`, `username`, `password`, `email`, `fname`, `lname`, `company`, `address`, `city`, `state`, `zip`, `country`, `currency`, `phone`, `vat`, `userlevel`, `created`, `notes`, `lastlogin`, `lastip`, `active`) VALUES\n"
. "(NULL, '$bridge_username', '1411678a0b9e25ee2f7c8b2f7ac92b6a74b3f9c5', '$bridge_email', '', '', NULL, '', '', '', '', '', '', '', NULL, 5, '2011-05-01 18:10:14', '', '2013-04-19 22:25:11', '127.0.0.1', 'y')");
}}}}}}}
$bridge_fname = $_POST['1_1_3'];
$bridge_lname = $_POST['1_1_4'];
if (isset ($_POST['1_1_3']) AND isset ($_POST['1_1_4'])) {
$mysqli->query("UPDATE `users` SET `fname` = '$bridge_fname',`lname` = '$bridge_lname' WHERE `users`.`username` = '$bridge_username'");
}