title: Issue while passing data through url in php
body: <p>Getting the below error while passing data from form through url to database in php</p>
  
  <pre><code>&lt;b&gt;Notice&lt;/b&gt;:  Trying to get property 'name' of non-object in 
  &lt;b&gt;C:\xampp\htdocs\api\product\create.php&lt;/b&gt; on line &lt;b&gt;24&lt;/b&gt;&lt;br /&gt;
  &lt;b&gt;Notice&lt;/b&gt;:  Trying to get property 'price' of non-object in 
  &lt;b&gt;C:\xampp\htdocs\api\product\create.php&lt;/b&gt; on line &lt;b&gt;25&lt;/b&gt;&lt;br /&gt;
  &lt;br /&gt;
  &lt;b&gt;Notice&lt;/b&gt;:  Trying to get property 'description' of non-object in 
  &lt;b&gt;C:\xampp\htdocs\api\product\create.php&lt;/b&gt; on line &lt;b&gt;26&lt;/b&gt;&lt;br /&gt;
   &lt;br /&gt;
  &lt;b&gt;Notice&lt;/b&gt;:  Trying to get property 'category_id' of non-object in 
  &lt;b&gt;C:\xampp\htdocs\api\product\create.php&lt;/b&gt; on line &lt;b&gt;27&lt;/b&gt;&lt;br /&gt;
   {"message": "Product was created."}
  </code></pre>
  
  <p>Find below code from the file create.php where I face issue while passing the data to the database from form after submission.</p>
  
  <p>create.php:</p>
  
  <pre><code>&lt;?php
     // required headers
     header("Access-Control-Allow-Origin: *");
     header("Content-Type: application/json; charset=UTF-8");
     header("Access-Control-Allow-Methods: POST");
     header("Access-Control-Max-Age: 3600");
     header("Access-Control-Allow-Headers: Content-Type, Access-Control-Allow- 
     Headers, Authorization, X-Requested-With");
  
    // get database connection
     include_once '../config/database.php';
  
   // instantiate product object
    include_once '../objects/product.php';
  
    $database = new Database();
    $db = $database-&gt;getConnection();
  
   $product = new Product($db);
  
   // get posted data
    $data = json_decode(file_get_contents("php://input"));
  
    // set product property values
   $product-&gt;name = $data-&gt;name;
   $product-&gt;price = $data-&gt;price;
   $product-&gt;description = $data-&gt;description;
   $product-&gt;category_id = $data-&gt;category_id;
   $product-&gt;created = date('Y-m-d H:i:s');
  
   // create the product
   if($product-&gt;create()){
      echo '{';
         echo '"message": "Product was created."';
     echo '}';
    }
  
  // if unable to create the product, tell the user
   else{
     echo '{';
         echo '"message": "Unable to create product."';
    echo '}';
    }
  
     ?&gt;
  </code></pre>
  
  <p>Kindly help to solve this issue by passing the data from form through url to database using php. </p>