i'm try to send some post value using postman to my script php... but i can print out the value post only if i use the x-www-form-urlencoded and not if i send data via form-data?
why this? can't understand differance between x-www-form-urlencoded and form-data.
php code test:
<?php
// this script call to register new user into db
require ("../private/index.php");
if ($_SERVER['REQUEST_METHOD'] == "POST") {
$staff = $_POST['staff_ID'];
$email = $_POST['email'];
$pass = $_POST['password'];
$name = $_POST['Name'];
$surname = $_POST['Surname'];
$role = $_POST['Role'];
$instructor = $_POST['Instructor'];
$date = $date = date("Y-m-d H:i:s",time());
$dataReceived = array('staff_ID'=>$staff,
'email'=>$email,
'password'=>$pass,
'Name'=>$name,
'Surname'=>$surname,
'Role'=>$role);
echo json_encode($dataReceived);
$sql = "INSERT INTO `users_nx`(`staff_ID`,`password`,`email`,`Name`,`Surname`,`Role`) VALUES ($staff,$pass,$email,$name,$surname,$role)";
if ($mysqli->query($sql) === TRUE) {
echo resultOperations(true, $mysqli);
} else {
echo resultOperations(false,$mysqli);
}
}