Complete Code For Implement PHP Code For Swapping Two Numbers.
<!DOCTYPE html> <html> <head> <title>How To Implement PHP Code For Swapping Two Numbers</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;">PHP Code For Swapping Two Numbers</h1> </div> <div class="well"> <form method="post"> Enter a Number1: <input class="form-control" type="text" name="number1"><br><br> Enter a Number2: <input class="form-control" type="text" name="number2"><br><br> <input type="submit" class="btn btn-success" name="submit" value="Submit"> </form> <?php if (isset($_POST['number1'])) { $a = $_POST['number1']; $b = $_POST['number2']; $third = $a; $a = $b; $b = $third; echo "After swapping:<br><br>"; echo "a =".$a." b=".$b; } ?> </div> </div> </body> </html>