i tried to do some practise about form actions and inputs and copy-paste a piece of codes but i got Undefined index: fname and Undefined index: age. The codes were taken from very popular php tutorial website, there should not be any problem with them but submitting them anyway.Is this server error or something like that?
<form action="posting.php" method="post">
Name: <input type="text" name="fname" />
Age: <input type="text" name="age" />
<input type="submit" />
</form>
<?php
echo $_POST["fname"];
echo $_POST["age"];
?>
You need to make sure
$_POSTis getting information before you try to read from it. There are a variety of ways to do this. Here’s one: