Using isset($_REQUEST('name')) in PHP


How To Avoid the Undefined Index Error in PHP?



If you don't want your PHP page to give out errors as shown in the previous exercise, you should consider checking all expected input fields in $_REQUEST with the isset() function as shown in the example script below:

  if (isset($_REQUEST['name'])) {
    $name = $_REQUEST['name'];
  } else {
    $name = "";
  if (isset($_REQUEST['comment'])) {
    $comment = $_REQUEST['comment'];
  } else {
    $comment = "";
  print("You have submitted the following information:\n");
  print("  Name = $name\n");
  print("  Comments = $comment\n");
  print("Thank you!\n");


Listing All Values of Submitted Fields in PHP

Expected Input Field Not Submitted in PHP

Processing Web Forms in PHP

⇑⇑ PHP Tutorials

2016-11-15, 3560🔥, 0💬