Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

169
Views
Using value posted to bootstrap modal

Good Day Folks, seeking your assistance with a little issue.

The code presentation will be in three parts.

I have passed a value to a modal from a form using javascript. I want to use that value to run a query to populate the fields in the modal. I have placed the value to the modal in type=hidden and I have verified that the value is present in the modal. However in the when I try to use the value using $variableName = $_POST['valueName']; it throws this error: Warning : Undefined array key "regulation" in C:\xampp\htdocs\JCF_Portal\php\userEditModal.php on line 7 Line 7 is <?php echo $RegNum; ?>

How can I resolve this problem?

Here are the code snippets:

<td><form action='' method='POST'><div class='btn-group' role='group'><button type='button' class='btn btn-warning' data-bs-toggle="modal" data-bs-target="#userEdit" onclick="editUser()">EDIT</button><input type='button' class='btn btn-danger' name="passwordReset" value='RESET' /><button type='button' class='btn btn-danger' data-bs-toggle="modal" data-bs-target="#userDelete" onclick="editUser()">DELETE</button><input type='hidden' id="registration" name='regNumber' value="<?php echo $row["RegNumber"] ?>"/></div></form></td>

This one triggers the modal and runs the JS Function

function editUser()
{     
    document.getElementById('regulationNumber').value = document.getElementById('registration').value
}

JavaScript Function the pushes value to type=hidden on modal.

<div class="modal-header">
  <input type="hidden" name="regulation" id="regulationNumber" value="">
  <?php $RegNum = $_POST['regulation']; ?>
  <h5 class="modal-title" id="exampleModalLabel">Edit User - <?php echo $RegNum; ?> </h5>
  <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close></button>
</div>

These are they, could you tell me where I have gone wrong, please?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!