Jump to content

Problem geting a variable



  1. 1. it's a probem with html or php?

    • .php
    • .html

Recommended Posts

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>	<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	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 by Baconian
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...