I have an exiting PHP / HTML live site that works just fine. I am changing the site function and need to add conditional statements based on this new criteria that did not exist before. I don't want to recode the entire page. I want similar code that works and solves my problem without a code redesign. The page loads but my form (below all of this) is not posting any more. I know its this new code because the page has worked for 5 years before these new conditions have been added.
I've inserted 3 conditional if, else if, else if statements surrounding existing page redirects based on the criteria, there only used to be one set of page redirects and the code worked perfectly. Now I have repeated them in between the if / else if conditions. It works with some conditions but not others.
(old stuff that works)
if ($var > 0) { //existing working conditions
some code
if ($var2 > 0) { //existing working conditions
(end old stuff that works)
((new stuff))
if (($type == 'R')&&($age > '17')){ /// Type R AND 18 or older
if($adult == "0"){
header('location: adult.php?test='.$id.''); }
else if($a_values == "0"){
header('location: a_values.php?test='.$id.''); }
(many more pages to check)
} else if (($type == '')&&($age > '17')){ /// No Type AND 18 or older
if($adult == "0"){
header('location: adult.php?test='.$id.''); }
else if($a_values == "0"){
header('location: a_values.php?test='.$id.''); }
(many more pages to check)
} else if (($type == 'C')&&($age < '18')){ // else Type C OR not 18 yo
if($not_adult == "0"){
header('location: not_adult.php?test='.$id.''); }
else if($not_adultt_values == "0"){
header('location: not_adult_values.php?test='.$id.''); }
(many more pages to check)
} else { // end ((new stuff)) and execute the rest of page if none of the if/else conditions and redirects are met
((old stuff that works))
} // end $var2
} // end $var
I don't want to use a different coding methodology. I just want to figure out the correct logic / syntax so that the page works like it used to and the form below processes correctly.
Aucun commentaire:
Enregistrer un commentaire