mardi 4 juillet 2017

how to reduce number of condition checks when I select one/two/three/four/five/six from the 6 select options?

example: when i have only two select options

input_one = 'one';

input_two = 'two';

//when i select only input_one

if((isset($_POST['input_one']) && (!isset($_POST['input_two']) { //query }

//When i select only input_two

elseif((!isset($_POST['input_one']) && (isset($_POST['input_two'])){//query }

//When i didn't select any of those

elseif((!isset($_POST['input_one']) && (!isset($_POST['input_two'])){//query }

//When i select both of them

elsif((isset($_POST['input_one']) && (!isset($_POST['input_two'])){//query }

but when i have 6 input options then i need to write more number of conditions, how to reduce those, if there is any alternate method, please help me out from this.

Thanks

suresh

Aucun commentaire:

Enregistrer un commentaire