PHP Classes

File: fwphp/glomodul/z_examples/AJAX_form_valid/ajax/1002a_frm_valid_jQuery.php

Recommend this page to a friend!
  Classes of Slavko Srakocic   B12 PHP FW   fwphp/glomodul/z_examples/AJAX_form_valid/ajax/1002a_frm_valid_jQuery.php   Download  
File: fwphp/glomodul/z_examples/AJAX_form_valid/ajax/1002a_frm_valid_jQuery.php
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: B12 PHP FW
Manage database records with a PDO CRUD interface
Author: By
Last change: Update of fwphp/glomodul/z_examples/AJAX_form_valid/ajax/1002a_frm_valid_jQuery.php
Date: 1 year ago
Size: 415 bytes
 

Contents

Class file image Download
<?php
$errors
= array();
$response = array();

if(empty(
$_POST['name'])){
 
$errors['name'] = 'Name is needed!';
}
if(empty(
$_POST['email'])){
 
$errors['email'] = 'Email is needed!';
}

$response['errors'] = $errors;

if(!empty(
$errors)){
 
$response['success'] = false;
 
$response['message'] = 'FAIL!';
} else {
 
$response['success'] = true;
 
$response['message'] = 'SUCCESS!';
}

echo
json_encode($response);