<?php $variable1= $_POST['field1'];//set a variable to identify different conditions for an if/else statement. //set up the if/else statement to check for a condition if($variable1=='(SOME CONDITION)') { //if the variable meets the first condition, have the code inside the brackets perform some function echo "variable1 equals 1"; } else { //if the variable does not meet the first condition, have the code inside the brackets perform another function echo "variable1 does not equal 1"; } ?>
DISPLAY
variable1 equals1
---------------------------------------------------------------------------------------------------------------<?php $variable1= $_POST['field1'];//set a variable to identify different conditions for an if/else statement. //set up the if/else statement to check for a condition if($variable1=='(SOME CONDITION)') { //if the variable meets the first condition, have the code inside the brackets perform some function echo "variable1 equals 1"; } //else if can be repeated as many times as necessary elseif($variable=='(SOME OTHER CONDITION)') { //if the variable meets the second condition, have the code inside the brackets perform some function echo "variable1 does not equal 1"; } ?>
DISPLAY
variable1 does not equal 1
---------------------------------------------------------------------------------------------------------------<?php $variable1= $_POST['field1'];//set a variable to identify different conditions for an if/else statement. //set up the if/else statement to check for a condition if($variable1=='(SOME CONDITION)') { //if the variable meets the first condition, have the code inside the brackets perform some function echo "variable1 equals 1"; } //else if can be repeated as many times as necessary elseif($variable=='(SOME OTHER CONDITION)') { //if the variable meets the second condition, have the code inside the brackets perform some function echo "variable1 does not equal 1"; } else { //if the variable does not meet the first condition or second condition, have the code inside the brackets perform another function echo "variable1 does not equal 99"; } ?>
DISPLAY
variable1 does not equal 99