PHP $_POST spits out "Notice: Undefined index:" -


i've been playing around php post & seem never work properly. i've looked on trying understand why html elements cannot found through name tags no avail.

the common response add: if(isset($_post[...])) when included, form never goes through returns false.

<html> <body> <form action="" method="post">     <input type="text" placeholder="name here" name="name">     <input type="submit" name="submit" value="show name"> </form> </body> <?php if(isset($_post["submit"])){     echo $_post["name"]; }else echo "no name"; ?> </html> 

is interpreter issue? have replicated other people's sample code in theirs works still faced same issues.

in php script, use $_post. because method specified in html form says post. if want use $_get change method attribute , not post.
alternatively can use $_request, although it's not security safe.

if else fails, place php script @ top before html


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -