Complete Code For Implement PHP Program To Find Sum Of Digits.
<!DOCTYPE html> <html> <head> <title>How Do I Convert From Mach To Knots Using Javascript</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet"> </head> <style> body { background: black; } .form-control { width: 80%; !important; } </style> <body> <body> <div class="container"> <br/><br/> <div class="text-center"> <h1 id="color" style="color: white;">Convert From Mach To Knots Using Javascript</h1> </div> <div class="well"> <form name="num" action="#" method="POST"> <input class="form-control" type="text" name="num" /> </form> <?php if(isset($_POST['num'])) { $num = $_POST['num']; $sum=0; $rem=0; for ($i =0; $i<=strlen($num);$i++) { $rem=$num%10; $sum = $sum + $rem; $num=$num/10; } echo "Sum of digits is $sum"; } ?> </div> </div> </body> </html>