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:<?php if (isset($_REQUEST['name'])) { $name = $_REQUEST['name']; } else { $name = ""; } if (isset($_REQUEST['comment'])) { $comment = $_REQUEST['comment']; } else { $comment = ""; } print("<html><pre>"); print("You have submitted the following information:\n"); print(" Name = $name\n"); print(" Comments = $comment\n"); print("Thank you!\n"); print("</pre></html>\n");?>
PHP
Topic: PHP Forms
How To Avoid the Undefined Index Error?
Browse random answers:
What are the method available in form submitting?
What are the differences between GET and POST methods in form submitting?
How To Create a Web Form?
How To Generate a Form?
what are the various methods to pass data from one web page to another web page ?
Where Is the Submitted Form Data Stored?
How To Retrieve the Submitted Form Data?
What Happens If an Expected Input Field Was Not Submitted?
How To Avoid the Undefined Index Error?
How To List All Values of Submitted Fields?
What Are Input Values of SELECT Tags?
How To Specify Input Values for Radio Buttons?
How To Specify Input Values for Checkboxes?
How To Supply Default Values for Text Fields?
How To Remove Slashes on Submitted Input Values?
How To Support Hidden Form Fields?
Difference between Get and Post?
Difference between $_GET and $_POST ?
What is $_REQUEST method for ?
How can we access the data sent through the URL with the GET method?
How can we access the data sent through the URL with the POST method?
what is max POST size.
Default upload max file size of file a file in php.ini?.