sagaida

php

Aug 18th, 2016
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.32 KB | None | 0 0
  1. <?
  2.  
  3. $data = $_POST;
  4.  
  5. $response = array("status" => "ok");
  6.  
  7. $error = array();
  8.  
  9. foreach ($data as $key=>$value){
  10.   $value = trim($value);
  11.   if(empty($value)){
  12.       $response['status'] = "error";
  13.       $error[$key] = "Заполните поле";
  14.   }
  15. }
  16.  
  17. $response['error'] = $error;
  18.  
  19. print json_encode($response);
Add Comment
Please, Sign In to add comment