Dear Sir,
I have modified your codes once again as
<?php
if (isset($_POST['button1'])){
$name=$_POST['text1'];
}else{
$name="";
}
if ($name) {
echo 'My name is ' . $name;
}else{
echo 'No name entered';
}
?>
<html>
<head>
<title>
First form
</title>
</head>
<body>
<form name="aa" method="POST">
Name
<input type="text" name="text1" value="">
<input type="submit" value="Display" name="button1">
</form>
</body>
</html>
It has no error, I need little modification again.
When I load page it says:
No name entered
When I press Display button then it must run following codes
<?php
if (isset($_POST['button1']))&& !empty($_POST['text1']){
$name=$_POST['text'];
if ($name) {
echo 'My name is ' . $name;
}else{
echo 'No name was Entered';
}
}
?>
Why it runs above codes without pressing Display Button?