×

Please Login or Register to continue.

5
(969 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";
  }
?>

 

(90 Points)
in PHP

Share

3 Answers
(9.4K Points)
(edited)
1

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.  

 


Comment

(7.3K Points)
0

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. 


Comment

(4.3K Points)
(edited)
0

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 


Comment

Related Questions :-

Featured Items:-


Certificate and Marksheet system with verification & Franchise in PHP

$75



Certificate system in PHP website | PHP scripts

$22



Home Credito loan finance management multipurpose system in PHP

$65




Your Answer

You can post your answer after login..

Live Chat

Hello! How can we assist you today?