I assuming you're using register_global on, so make it OFF 🙂.
and for your problem you can use isset maybe, eg:
<?php
/* for register_global on if (isset($submit) && ($submit == 'click')){
* but better you start using coding with register global off :D
*/
if (isset($_POST['submit']) && ($_POST['submit'] == 'click'))
{
echo "hello ," . $_POST['UserName'];
}
else {
<html><body>
<form method="post" action="test.php">
Enter Your Name
<input type="text" name="UserName"></input><br>
<input type="submit" name="submit" value="click"></input>
</form>
</body></html>
';
}
?>
or, to avoid seeing notice error you can edit php.ini to :
; - Show all errors, except for notices
;
error_reporting = E_ALL & ~E_NOTICE
hope that help.
PS: oops, i don't see drew post sorry.