Click here to Skip to main content
15,908,841 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
<html>
<body>

<form action="welcome.php" method="post">
Name: <input type="text" name="fname" />
Age: <input type="text" name="age" />
<input type="submit" name="submit" />
</form>

</body>
</html>







*welcome.php*
<?php
if(isset($_POST["age"]))
{
echo "hi !".$_POST["fname"]."<br/>";
echo "ur age is".$_POST["age"];
}
else{

<html>
<body>

<form action="welcome.php" method="post">
Name: <input type="text" name="fname" />
Age: <input type="text" name="age" />
<input type="submit" name="submit" />
</form>

</body>
</html>
}
?>
Posted

I don't understand your mean, but I think file "welcome.php" is wrong
you don't attend to put end&start php tags and this is true:

<?php
if(isset($_POST["age"]))
{
echo "hi !".$_POST["fname"]."<br/>";
echo "ur age is".$_POST["age"];
}
else{
?>
<html>
<body>

<form action="welcome.php" method="post">
Name: <input type="text" name="fname" />
Age: <input type="text" name="age" />
<input type="submit" name="submit" />
</form>

</body>
</html>
<?php
}
?>
 
Share this answer
 
Hi....


Replace all your code of block by.....

if($_POST['submit'])
{
	echo "hi !".$_POST["fname"]."<br />"; 
	echo "ur age is".$_POST["age"];
}
?>
<html>
<body>
 
<form action="" method="post">
	Name: <input type="text" name="fname" />
	Age: <input type="text" name="age" />
	<input type="submit" name="submit" />
</form>
 
</body>
</html>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900