Baconian Posted April 29, 2014 Share Posted April 29, 2014 (edited) Hey guys! i'm a newbie and i'm having a problem with a simple form. Probably it's a simply detail but i can't get it :/ so every comment helps a lot! The form is submitted in .html but the info put on form apparently don't reach the .php file and i don't have the minimal idea of what is wrong the error is: Notice: Undefined index: user in C:xampphtdocsforminsert.php on line 6 not cathing user .html <html> <head><title>Home</title></head> <body> <h1>Login</h1> <form method="post" action="insert.php" enctype="text/plain"> <input type="text" name="user" placeholder="insert your username"> <input type="submit" value="Login"> </form> </body></html> .php <?php session_start(); include('conectaDB.php'); $user = $_REQUEST["user"];//line 6 if(!isset($user)){echo("not cathing user");exit();} var_dump($user); $sql="INSERT INTO User (IDUSER) VALUES($user)"; var_dump($sql); $resultado = mysqli_query($conexao,$sql); if($resultado){echo("worked!");} else{echo("ERROR sql insert: ".$sql);} mysqli_close($conexao);?> in all browsers i've tried(chrome, firefox and IE) the result is the same :/ Edited April 29, 2014 by Baconian Link to comment Share on other sites More sharing options...
justsomeguy Posted April 29, 2014 Share Posted April 29, 2014 Remove the enctype attribute from the form. Link to comment Share on other sites More sharing options...
Baconian Posted May 5, 2014 Author Share Posted May 5, 2014 Really thanks Justsomeguy! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now