Welcome to Techno Smarter QA, Question, Answer forum. Ask questions, receive answers, or help someone. Join Now
Welcome to Techno Smarter Q&A, where you can ask questions and receive answers from other members of the community. Ask the Technical & Programming related questions that you want. Join our community and help others .
+5 votes

I am getting undefined errors in PHP. I am trying to insert data into MYSQL database using PHP but I am getting errors. I am attaching an image with an error. I want to insert data into the database using PHP.

Please Solve this problem I don't know whats mistake

PHP code - 


   include "init.php";


   $fullname = $_POST['fullname'];

   $username = $_POST['username'];

   $password = $_POST['password'];


   $enc_password = md5($password);


   $result  = "INSERT into tb_user(fullname, username,password) VALUES( '$fullname', '$username', '$enc_password' )";


if( mysqli_query($conn, $result))


            echo "Success";




             echo "Failed";



in PHP by (90 points) 3 18 31
Kindly share more details. Where is your HTML form?

3 Answers

+1 vote

You are getting the variable undefined error in PHP. You are created fullname, username, password three variables in PHP. Have you defined these variables' names in the HTML form to verify the value of the field? If you are not defined, then you should define in every single input box - 

Like - 

<input type="text" name="fullname"> 

<input type="text" name="username"> 

<input type="text" name="passsword"> 

The names should be the same name in PHP. I think you are not defined variables name in HTML form. Follow the process above. Define all names and execute the PHP script.  

by (9.1k points) 11 25 63
0 votes

Thanks for posting again. I am here to assist you. You are getting three undefined error. These errors are showing that you are not defined as these variables in HTML form or PHP properly. You are not posted your HTM code in question description. It will be easy to demonstrate. Well, I have a reference for you . It will be useful for you to insert data into the database .  

Signup Form using PHP & MYSQL | Simple Registration System

Checkout this Signup form. It will help you insert data into a database using PHP and MYSQL database. 

by (7.2k points) 14 29 62
0 votes

You are getting these errors- 

NOTICE Undefined index: fullname on line number 7

NOTICE Undefined index: username on line number 9

NOTICE Undefined index: password on line number 11

Kindly share your HTML code 

by (4k points) 8 29 54