I'm using PHP form to send user registration data and then handle it with PHP form. I need to register a few user types such as "normal users," "admin users," "edit enabled users," etc. Details requests for registration of every kind of user are different. But I hope to use the same formDataManagement.php file. When I click the "Submit" button, an error message shows.
Undefined array Key.
Form data section
<input type="hidden" id="companyname" name="companyname" value="">
<input type="hidden" id="regno" name="regno" value="">
<input type="hidden" id="farmaddress" name="farmaddress" value="">
<input type="hidden" id="role" name="role" value="admin">
<input type="hidden" id="designation" name="designation" value="manager"> 
formDataManagement.php
//if user signup button
if(isset($_POST['signup'])){
    $name = mysqli_real_escape_string($con, $_POST['name']);
    $email = mysqli_real_escape_string($con, $_POST['email']);
    $password = mysqli_real_escape_string($con, $_POST['password']);
    $conpassword = mysqli_real_escape_string($con, $_POST['conpassword']);
    $compName = mysqli_real_escape_string($con, $_POST['companyname']);
    $role = mysqli_real_escape_string($con, $_POST['role']);
    $regno = mysqli_real_escape_string($con, $_POST['regno']);
    $designation = mysqli_real_escape_string($con, $_POST['designation']);
    $farm_address = mysqli_real_escape_string($con, $_POST['farmaddress']);
    $resi_address = mysqli_real_escape_string($con, $_POST['resaddress']);
}
   
But after the process, it shows the following error.
Warning: Undefined array key "companyname" in C:\xampp\htdocs\test\admin\register\formDataManagement.php on line 15
Warning: Undefined array key "regno" in C:\xampp\htdocs\test\admin\register\formDataManagement.php on line 17
Warning: Undefined array key "farmaddress" in C:\xampp\htdocs\test\admin\register\formDataManagement.php on line 22
Can't I send empty values as hidden input values? Please advise solving this issue.
 
     
     
    