0

This is my code

if ($_SERVER['REQUEST_METHOD'] === 'POST')
{
  $sql = 'UPDATE checklist_programs
  SET PROGRAM_ID='.$_POST['PROGRAM_ID'].'
  WHERE CHECKLIST_ID = ?';
  $query = mysqli_query($connection, $sql);
  if($query)
  {
    echo "Record update successfully";
    header('Location: OverViewCheckList.php');
  }

I got an error like this

Notice: Array to string conversion in C:\xampp\htdocs\checklist\updateChecklist.php

1Hund TV
  • 7
  • 3

1 Answers1

0

It is possible that $_POST['PROGRAM_ID'] contains an array itself. If the form that is posting to this program has multiple fields with the name PROGRAM_ID[], this will happen. See How to get form input array into php array for an example of how this works.

Also, see the related post about how to prevent SQL injection in PHP.

Community
  • 1
  • 1