You can use the next code:<html>
<body>
<?php
if(isset($_POST['FirstName'])) echo 'First Name is
'.$_POST['FirstName'].'<br/>'; //if we receive any data - print not null
on page
if(isset($_POST['LastName'])) echo 'Last Name is
'.$_POST['LastName'].'<br/>';
if(isset($_POST['Age'])){ echo 'Age is
'.$_POST['Age'].'<br/>';
if($_POST['Age']<18) echo 'You're kid'; //checking age
of user
if($_POST['Age']>=18 && $_POST['Age']<35) echo
'You're mature';
if($_POST['Age']>=35) echo 'You're old!!!'; }
?>
<form action="?" method="POST" >
First Name<br/>
<input type="text"
name="FirstName"><br/>
Last Name<br/>
<input type="text" name="LastName"><br/>
Age<br/>
<input type="text"
name="Age"><br/>
<input type="submit"
value="Submit"><br/>
</form>
</body>
<html>
Comments
Leave a comment