• Register
Welcome to Techno Smarter QA, Questions, Answers Community
Welcome to Techno Smarter Q&A, where you can ask questions and receive answers from other members of the community. Ask the tech & programming Question that you want. Guests Posting are allowed.
+4 votes
36 views

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 - 

<?php

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

  }

        else

          {

             echo "Failed";

  }

?>

in PHP by (320 points) 5 18
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 (7.1k points) 4 20 46
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 (5.1k points) 4 15 45
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 (3.1k points) 1 13 37
...