Inside Array – “unidentified index” error with “prepare was called incorrectly” despite not calling the prepared statement with wordpress [closed]

I saw in your code the $_POST[‘phonenumber’] doesn’t check isset so may be this is an error you try to find. I think you can try this

if (!empty($_POST)) {
        global $wpdb;
        $table = "mytablenameplaceholder";
            if(isset($_POST['name']) && isset($_POST['emailaddress'])){
  $number1 = $_POST['name']; 
  $message = $_POST['emailaddress']; 
  $message = urlencode($message); 

  //process phonenumber
  $phonenumber="";
  if(isset($_POST['phonenumber'])){
    $phonenumber = $_POST['phonenumber'];
  }
  //END - process phonenumber

        $data = array(
            'name' => $_POST['name'],
            'emailaddress'    => $_POST['emailaddress'],
            'phonenumber'    => $phonenumber
        );
        $format = array(
            '%s',
            '%s'
        );
        $success=$wpdb->insert( $table, $data, $format );
        if($success){
            echo 'data has been saved' ; 
        }
    } else {
?>
    <form action="" method="post" >
        <input type="text"  id="name" name="name" value="John">
        <input type="text" name="email">
        <input type="text" name="phonenumber">
        <input type="submit">
    </form>
<?php
    }