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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...