Tools, FAQ, Tutorials:
Using isset($_REQUEST('name')) in PHP
How To Avoid the Undefined Index Error in PHP?
✍: FYIcenter.com
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"); ?>
⇒ Listing All Values of Submitted Fields in PHP
2016-11-15, 2553👍, 0💬
Popular Posts:
Why am I getting this "Docker failed to initialize" error? After installing the latest version of Do...
How to write a policy to set and get custom variables? Here is a policy that sets and gets custom va...
How to attach console to a Running Container using the "docker container exec" command? I want to ge...
How To Add Column Headers to a Table? If you want to add column headers to a table, you need to use ...
How To Protect Special Characters in Query String in PHP? If you want to include special characters ...