<?php
if(isset($_POST['name'])&&isset($_POST['age']))
{
$name=$_POST['name'];
$age=$_POST['age'];
if(!empty($name)&&!empty($age))
{
echo '<center>name :<b>'.$name.'</b> age :<b>' .$age.'</b><br><br></center>';
}
else
{
echo '<center><b>you not filled both fields</b><br><br></center>';
}
}
?>
<center><form action="form.php" method="POST">
NAME :<input type="text" name="name">
AGE :<input type="text" name="age">
<input type="submit" value="submit">
</form></center>
output :
1)if you filled all fields output displays that is you entered data
other wise it gives a message as " you not filled both fields "
2) if you give html entities then it also displays as it is
if(isset($_POST['name'])&&isset($_POST['age']))
{
$name=$_POST['name'];
$age=$_POST['age'];
if(!empty($name)&&!empty($age))
{
echo '<center>name :<b>'.$name.'</b> age :<b>' .$age.'</b><br><br></center>';
}
else
{
echo '<center><b>you not filled both fields</b><br><br></center>';
}
}
?>
<center><form action="form.php" method="POST">
NAME :<input type="text" name="name">
AGE :<input type="text" name="age">
<input type="submit" value="submit">
</form></center>
output :
1)if you filled all fields output displays that is you entered data
other wise it gives a message as " you not filled both fields "
2) if you give html entities then it also displays as it is