Helps $_GET method

0 Savad Dekrup · August 15, 2014
Hello, I was trying to learn PHP. So, I searched it online and found TutorialPoint.com was a good source. Then I tried their codes and understood it well. However I got these weird error, not sure how to fix them.

Note: The function works well, but I'm not sure why I am getting the 'Notice'.


Error:



Notice: Undefined index: name in C:\xampp\htdocs\index.php on line 2

Notice: Undefined index: age in C:\xampp\htdocs\index.php on line 2



My Code: 


<?php
  if( $_GET["name"] || $_GET["age"] )
  {
     echo "Welcome ". $_GET['name']. "<br />";
     echo "You are ". $_GET['age']. " years old.";
     exit();
  }
?>
<html>
<body>
  <form action="<?php $_PHP_SELF ?>" method="GET">
  Name: <input type="text" name="name" />
  Age: <input type="text" name="age" />
  <input type="submit" />
  </form>
</body>
</html>

Cheers,
SavadDekrup

Post a Reply

Replies

Oldest  Newest  Rating
0 Savad Dekrup · August 15, 2014
Oh yeah, it works. Thanks :D
  • 1

PHP

107,021 followers
About

Server-side, HTML embedded scripting language used to create dynamic Web pages.

Links
Moderators