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

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -