# Not able to insert value to the database

**URL:** <https://forum.ionicframework.com/t/not-able-to-insert-value-to-the-database/128974>\
**Category:** ionic-v3\
**Created:** [April 26, 2018, 7:38am UTC](https://forum.ionicframework.com/t/not-able-to-insert-value-to-the-database/128974 "2018-04-26T07:38:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![flycoders\_sourav](https://avatars.discourse-cdn.com/v4/letter/f/e47c2d/32.png) [@flycoders\_sourav](https://forum.ionicframework.com/u/flycoders_sourav)\
**Post date:** [April 26, 2018, 7:38am UTC](https://forum.ionicframework.com/t/not-able-to-insert-value-to-the-database/128974/1 "2018-04-26T07:38:18Z")

</div>

I want to insert value to the database  
**.ts**

```auto
submitData() {
    let datatopost:any = {};
    if(this.MySelect1.length >0) {
      for(let i=0; i<=this.MySelect1.length; i++) {
        datatopost = {"name":this.doc_name[i],"address":this.doc_add[i],"contact":this.doc_cont[i]};
        this.post_to_server.push(datatopost);
      }
      console.log("Final Data...");
         this.http.post("http://www.mydomain.com/test/append/includes/classes/multiplefield/insert.php",JSON.stringify(this.post_to_server))
      .subscribe(data => {
       let temData =data.json()
        let response = temData.code;

      }, error => {
        
        // Error getting the data
        console.log(error);
      });
  }
 }

```

below my php code **.php**

```auto
<?php include 'connection.php'; if($conn) 
{ 

$json = file_get_contents('php://input'); 
$obj = json_decode($json,true); 
foreach($obj as $key => $value) {
    echo $value->name;
 $query = 'insert into multiple_filed (send_time,send_location,send_comments) values('.$value->name.','. $value->address.','. $value->contact.')';
  mysqli_query($conn,$query); } }

  ?>

```

Showing an error like this **Trying to get property of non-object**  
please help me out  
Thanks

---

<div class="post-metadata">

**Author:** ![mhartington](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/mhartington/32/137757_2.png) [@mhartington](https://forum.ionicframework.com/u/mhartington)\
**Post date:** [July 19, 2021, 9:38pm UTC](https://forum.ionicframework.com/t/not-able-to-insert-value-to-the-database/128974/2 "2021-07-19T21:38:31Z")

</div>

Closed on July 19, 2021, 9:38pm UTC


