Hello friends today I will tell you through this tutorial how you can calculate odd number using php script code. So let's try to understand step by step.
Table of Topics
- HTML SCRIPT CODE
- PHP SCRIPT CODE
- PHP with Html Code
HTML Script Code
You have to create an html odd number checker form through html script code, you have been told below by example.
<html><head><meta charset="utf-8"><title>Odd Number Calculator</title></head><body><form method="post"><p>Input Your Number:<br/><input type="text" name="num"></p><input type="submit" name="submit" value="Check Odd Numbers"></form></body></html>
PHP Script Code
You have to create an odd number checker script Code through PHP script code, you have been told below by example.
<?php if (isset($_POST['submit'])) {$value = $_POST['num'];if ($value % 2) {echo '"'.$value.'" is odd Value.';}}?>PHP with Html Code
<html><head><meta charset="utf-8"><title>Odd Number Calculator</title></head><body><form method="post"><p>Input Your Number:<br/><input type="text" name="num"></p><input type="submit" name="submit" value="Check Odd Numbers"></form></body></html><?php if (isset($_POST['submit'])) {$value = $_POST['num'];if ($value % 2) {echo '"'.$value.'" is odd Value.';}}?>