Jump to content

Recommended Posts

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");	}
}

Link to comment
https://forums.phpfreaks.com/topic/128217-if-false-go-to-next-if/
Share on other sites

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.