Page 1 of 1

dropdown not validating

Posted: Thu Sep 23, 2010 9:27 am
by Obadiah
Im trying to validate my dropdown and I cant get why it wont validate,
the name of the dropdown's posted value is $areaReported. Its not checking to see that the user has anything other that "Select Area" selected and I cant figure out why

Code: Select all

<?php
if (($questnum >= 1) && ($areaReported != "Select Area")){
	echo $num_toggle_off;
	}
	else if(($questnum <= 1) || ($questnum >10) || ($areaReported == "Select Area")){
		echo $num_toggle_on; "<br>";
		echo "<p style=\"color:red\">Please enter valid number of records and/or Area to report on</p>";
	}

?>
thanks in advance for the assistance!

Re: dropdown not validating

Posted: Sat Sep 25, 2010 6:51 pm
by mecha_godzilla
I hope I'm not being thick here but it looks like you've got too many tests in there. Am I right in thinking that if $area_reported = "Select Area" and the number is between 1 and 10 then it's valid, and if not then the error message needs to be displayed?

The code that does what I'm describing looks like this:

Code: Select all

if (($questnum >= 1 && $questnum <= 10) && ($areaReported == "Select Area")){
	echo 'num_toggle_off';
} else {
	echo  'num_toggle_on' . "<br>";
	echo "<p style=\"color:red\">Please enter valid number of records and/or Area to report on</p>";
}
Is that what you need?

HTH,

Mecha Godzilla