Please Login or Register to continue.


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";


(90 Points)
in PHP


3 Answers
(9.4K Points)

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 variable names in HTML form. Follow the process above. Define all names and execute the PHP script.  



(7.3K Points)

Thanks for posting again. I am here to assist you. You are getting three undefined errors. These errors are showing that you are not defined as these variables in HTML form or PHP properly. You are not posted your HTML code in the 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. 


(4.3K Points)

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 


Related Questions :-

Featured Items:-

Certificate system in PHP website | PHP scripts


Home Credito loan finance management multipurpose system in PHP


Result management system with Marksheet in PHP website | PHP Scripts


Your Answer

You can post your answer after login..