Use
$_POST["firtname"]
. Look at your HTTP request method: it's POST.
Besides, before working with any PHP object, at least with the one coming from outside of your code, it's good to check up if it is initialized or not. This is how:
http://php.net/manual/en/function.isset.php[
^].
For comparison, see also:
http://php.net/manual/en/function.defined.php[
^].
In your case, you can really get unset object be the following reason: someone can load your page not as the
action
of your form, but simply by loading it by the URI in the browser (by whatever reason). You should be able to handle such situations in some reasonable way. In practice, many make the page with the form, and its form action the same. In this case, you would need to distinguish between loading this page with POST and without it.
[EDIT]
Your second problem is
<a href="reg.php">
. You simply request and load "reg.php" without the post, hence the problem. You need to use a Submit button instead:
<input type="submit" value="Register"/>
—SA