BAB
Php
code posted
by
ReptoxX
created at 04 Oct 16:37
Edit
|
Back
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
<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 ?> |
1015 Bytes in 3 ms with coderay