1. Create a simple form with two input fields for the user to enter two numbers performs
arithmetic operations (addition, substraction, multiplication, division) on them. The form
subtmits the data to a PHP scripts using GET method.
if(isset($_GET['num1']) && (isset($_GET['num2']))) {
$num1 = $_GET['num1'];
$num2 = $_GET['num2'];
echo "Addtiton " . $num1 . " + " . $num2 . " = " . $num1 + $num2;
echo "Subtraction " . $num1 . " - " . $num2 . " = " . $num1 - $num2;
echo "Multiplication " . $num1 . " x " . $num2 . " = " . $num1 * $num2;
echo "Divide " . $num1 . " / " . $num2 . " = " . $num1 / $num2;
}
2. Create a simple form that allows to input a message and counts the number of words in it.
The form submits the data to a PHP script using the GET method
if (isset($_GET['word'])) {
$word = $_GET['word'];
echo "( ".$word ." ) is " . str_word_count($word) . " word/s";
}