Title / Description
Code <form action="" method="get"> <!-- Please use Post instead of Get --> <table class="table table-normal"> <tr> <td>Name:</td> <td>Age:</td> </tr> <tr> <td><input type="text" name="name" placeholder="Enter your name"></td> <td><input type="num" name="age" placeholder="Enter your age"></td> </tr> </table> <input type="submit" name="submit" class="btn btn-lg btn-primary" value="ENTER"> </form> <?php $name = @$_GET['name']; // or use POST $age = @$_GET['age']; // or use POST if(isset($_GET['submit'])){ if(!empty($name) && !empty($name)){ echo "<p class='success'>You are " . $name . ", and you are " . $age . " Years old</p>"; } else { echo "<p class='error'>You must enter all fields</p>"; } } // POST method is much better then GET // It doesnt look so creepy <img src="https://phpacademy.org/img/smileys/wink.png" width="18" height="18" alt=";)" title=";)" class="bbcode_smiley"/> // But Get looks awesome with .htaccess - RewriteRule ?>
Author
Highlight as C C++ CSS Clojure Delphi ERb Groovy (beta) HAML HTML JSON Java JavaScript PHP Plain text Python Ruby SQL XML YAML diff code