Wednesday, 15 September 2010

html - Notice: Undefined index php $_request -



html - Notice: Undefined index php $_request -

i need eliminate warning if sentence tried utilize if $_request['fname'] not worked. i'm new in php

<!doctype html> <html> <body> <form method="post" action="<?php echo $_server['php_self'];?>"> name: <input type="text" name="fname"> <input type="submit"> </form> <?php if($_request['fname']){ $name = $_request['fname']; echo $name; } ?> </body> <html>

browser

notice: undefined index: fname in /var/www/php_functions.php on line 11

you can check isset()

try code:

if(isset($_request['fname'])){ $name = $_request['fname']; echo $name; }

php html

No comments:

Post a Comment