jesushax Posted October 13, 2008 Share Posted October 13, 2008 hi below is my code qwhich will hopefully explain the problem a little clearer if you look at the none set error statments, im checking for words in the field then if certain words are met do something, now if there not met its set to do nothing, but i want it to be set to the last else in the statement that its within, without having to repeat this bit if ($error["City"] =="1") {.... at the end of everyone of those anyone understand? if ($error["Cons"] !="1" && $error["City"] !="1") { header("Location: /admin/vacancies/edit_vacancy.php?ID=".$error["ID"]."&action=error1"); } elseif (empty($error["Ref"])) { header("Location: /admin/vacancies/edit_vacancy.php?ID=".$error["ID"]."&action=error2"); } elseif ($error["City"] =="1") { if ($error["CityCat"] =="None Set") { header("Location: /admin/vacancies/edit_vacancy.php?ID=".$error["ID"]."&action=error3"); } } elseif ($error["Cons"] =="1") { if ($error["ConsCat"] =="None Set") { header("Location: /admin/vacancies/edit_vacancy.php?ID=".$error["ID"]."&action=error4"); } } else { if ($error["City"] =="1") { header("Location: /admin/vacancies/edit_vac_list.php?CAT=$CityCat"); } elseif ($error["Cons"] =="1") { header("Location: /admin/vacancies/edit_vac_list.php?CAT=$ConsCat"); } } Quote Link to comment https://forums.phpfreaks.com/topic/128217-if-false-go-to-next-if/ Share on other sites More sharing options...
MadTechie Posted October 13, 2008 Share Posted October 13, 2008 Er... no you lost me.. what are you trying to do ? Quote Link to comment https://forums.phpfreaks.com/topic/128217-if-false-go-to-next-if/#findComment-664071 Share on other sites More sharing options...
Stooney Posted October 13, 2008 Share Posted October 13, 2008 That is one big bowl of spaghetti. By 'without having to repeat if($error["city"]=="1")' do you mean you need to check if $error['city']==1 on every if statement? Or is it different on each one? Break your question down into sentences maybe, it's pretty unclear. Quote Link to comment https://forums.phpfreaks.com/topic/128217-if-false-go-to-next-if/#findComment-664073 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.