PHP if else if else Statement - PHP if Statement - php form

PHP if elseif else Statement

PHP Summer Training/Internship with 2 Live Projects in Noida Fee is only 5500/-Click here to Book Your Seat

/ins>

Nested if else in PHP

The if-else-if-else statement lets you chain together multiple if-else statements, thus allowing the programmer to define actions for more than just two possible outcomes.

Check given character is vowel or consonant.

Output
d is consonant
Enter your number

First we create a textbox and a button using HTML script.
using $_POST[ ] collect value that is entered by user and store in a variable($char).
Now check the condition($char==”a”),($char==”e”),($char==”i”),($char==”0″) and so on.
Here we use nested if else because we need to select one of several blocks to be executed.
if the character enter by user are (a,e,i,o,u) it print, character is vowel else character is consonant.
Here user has entered “d” so the output will display like : d is consonant


Print related day name according to inputted number (1 – 7).

Output
Friday
Enter your number

First we create a textbox and a submit button using HTML script.
using $_POST[ ] collect value that is entered by user and store in a variable($day).
Now check the condition($day==1),($day==2),($day==3) and so on.
Here we use nested if else because we need to select one of several blocks to be executed.
if the number entered by user are (1 – 7) it print related statement, else wrong choice.
Here user has entered the value “5” so the output will display like : Friday

Latest Trending Technologies