PHP Classes

File: fwphp/glomodul/z_examples/AJAX_form_valid/mcArthur/listing18-9.php

Recommend this page to a friend!
  Classes of Slavko Srakocic   B12 PHP FW   fwphp/glomodul/z_examples/AJAX_form_valid/mcArthur/listing18-9.php   Download  
File: fwphp/glomodul/z_examples/AJAX_form_valid/mcArthur/listing18-9.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/mcArthur/listing18-9.php
Date: 1 year ago
Size: 526 bytes
 

Contents

Class file image Download
<?php
$arr
= array(
        
'Alpha','Bravo','Charlie','Delta','Echo',
        
'Foxtrot','Golf','Hotel','India','Juliett',
        
'Kilo','Lima','Mike','November','Oscar',
        
'Papa','Quebec','Romeo','Sierra','Tango',
        
'Uniform','Victor','Whiskey','X-ray','Yankee',
        
'Zulu'
      
);
$search = strtolower($_POST['search']);

$hits = array();

if(!empty(
$search)) {
  foreach(
$arr as $name) {
    if(
strpos(strtolower($name), $search) === 0) {
     
$hits[] = $name;
    }
  }
}

echo
json_encode($hits);