Jump to content

Recommended Posts

	if ($building != "Hooverville" && $buildling != "Summitview" && $building != "WAMS" && $building != "WASHS" && $building != "Mowery" && $buildling != "Clayton Avenue" && $building != "Fairview Avenue")
				//Clayton Avenue; Summitview do not work atm. 
				{
					$errorMessage .= "The entered buliding name ($building), does not match one of buildings in our district, ";
					$errorMessage .= "They have to be one of the following: Hooverville, Summitview, WAMS, WASHS, Clayton Avenue or Fairview Avenue";
				}

 

When I edit the user and enter Summitview or Clayton Avenue it says it is invalid. But as you see if it correct.

 

Any help would be great!

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/143264-validation/
Share on other sites

thats one looooooong if statement

why not simply use the in_array function and put the building names in a array.

If these buildings fetched from a database it would be even tiedier to use the id's

 

$buildings=array();
$buildings[]="building1";
$buildings[]="building2";
$buildings[]="building3";
if(!in_array($building,$buildings)){
  //error message stuff here
}

Link to comment
https://forums.phpfreaks.com/topic/143264-validation/#findComment-751325
Share on other sites

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.