Я надеюсь, что кто-то здесь может помочь мне, потому что я озадачен этой странной ошибкой в моем PHP-коде.Во-первых, вот соответствующая часть кода:
//STEP 1b - PREPROCESSING OF SUBMITTED FORM DATA (table level)
while($count_table++ != $num_tables && $submit != ""){
$table_show[$count_table] = mysql_escape_string($_POST[table_show_.$count_table]);
$ne_page[$count_table] = mysql_escape_string($_POST[ne_page_.$count_table]);
}
//STEP 2 - SUBMITTED?
if($submit!=""){
//The form has been submitted
//STEP 3 - VALIDATION
//Reset counts
$count_column = 0;
$count_table = 0;
//Check for empty fields
while($count_table++ != $num_tables){ if($table_show[$count_table] != ""){ //While there are tables, validate only if they are in included in NexEdit
Вот где в тестируемом сценарии if возвращает ложное значение.В результате он должен просто вернуться прямо к тому моменту перед ним (я закрываю время и, если дальше, в той же точке).
if($ne_page[$count_table] == ""){
$error = "You forgot to give a NexEdit name to one or more of the tables you want to include in NexEdit.";
}
echo "Debug";
Как и ожидалось, это никогда не отражается, потому чтоВо-первых, PHP никогда не вводил if раньше.
while($db_field[++$count_column]){ //Stay inside the loop until we run out of db fields
if($db_field[$count_column] == "" || $db_type[$count_column] == "" || $db_table[$count_column] == "" || $ne_name[$count_column] == "" || $ne_type[$count_column] == "" || $ne_order[$count_column] == ""){ //Check if all information is entered if the column is selected to be included in NexEdit
$error = "You didn't enter all required information. Required fields are indicated with (*).";
Вот здесь и происходит ошибка: , хотя PHP не должен был вводить if раньше (как показано на примереотладочный эхо), он все равно устанавливает здесь значение $ error.
}
}
}}
//More code...
Чего мне не хватает?Я смотрел на это часами и даже попросил помощи у разработчика, но просто не могу найти, что я сделал не так.
Весь код в одном блоке:
//STEP 1b - PREPROCESSING OF SUBMITTED FORM DATA (table level)
while($count_table++ != $num_tables && $submit != ""){
$table_show[$count_table] = mysql_escape_string($_POST[table_show_.$count_table]);
$ne_page[$count_table] = mysql_escape_string($_POST[ne_page_.$count_table]);
}
//STEP 2 - SUBMITTED?
if($submit!=""){
//The form has been submitted
//STEP 3 - VALIDATION
//Reset counts
$count_column = 0;
$count_table = 0;
//Check for empty fields
while($count_table++ != $num_tables){ if($table_show[$count_table] != ""){ //While there are tables, validate only if they are in included in NexEdit
if($ne_page[$count_table] == ""){
$error = "You forgot to give a NexEdit name to one or more of the tables you want to include in NexEdit.";
}
echo "Debug";
while($db_field[++$count_column]){ //Stay inside the loop until we run out of db fields
if($db_field[$count_column] == "" || $db_type[$count_column] == "" || $db_table[$count_column] == "" || $ne_name[$count_column] == "" || $ne_type[$count_column] == "" || $ne_order[$count_column] == ""){ //Check if all information is entered if the column is selected to be included in NexEdit
$error = "You didn't enter all required information. Required fields are indicated with (*).";
}
}
}}
//More code...