> For the complete documentation index, see [llms.txt](https://alaniso-de.gitbook.io/alaf-framework/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://alaniso-de.gitbook.io/alaf-framework/beispiele/alaf_server_side.php.md).

# alaf\_server\_side.php

```php
<?php
/**
 * This file is part of
 * ALAF - PHP Framework System.
 * Copyright by  www.alaniso.de
 *
 * @Revision: 0 @
 * @Author:  @
 * @Date: Tue 2017/12/30 16:22:00 CEST @
 */

/**
 * Framework Hauptdatei includen
 * Lädt u.a.: af_system und af_base (incl.g af_config)
 */
require_once ('../../../mainfile.php');

// Hauptverarbeitung läuft über das Modul:
load_class ( 'af_module' );
// Konstante AF_IS_USER und AF_IS_ADMIN setzen:
af_module::define_user_const ();

include_once (ALAF_MODULES_DIR . DS . 'Lager000' . DS . 'includes' . DS . "class.lager.php");

function AjaxBootstrapSelectLFA1($req) {
	global $obj_ajax;
	
	$SearchString = $req ['q'];
	
	$output = array ();
	
	// einfache Auswahlliste
	$arOpt = array ();
	
	// Datenbanktabelle (hier SASP):
	$tab_LFA1 = afSAP_get_dbtablename ( 'LFA1' ); // Lieferanten
	$fieldlist = [ ];
	$fieldlist [] = $tab_LFA1 . ".LIFNR";
	$fieldlist [] = $tab_LFA1 . ".NAME1"; // Langtext
	
	$arWhere = [ 
			
			"OR" => [ 
					$tab_LFA1 . '.LIFNR[~]' => $SearchString,
					$tab_LFA1 . '.NAME1[~]' => $SearchString 
			] 
	];
	
	$result = af_DbSelect ( $tab_LFA1, $fieldlist, $arWhere );
	
	
	$i = 0;
	if ($result) {
		foreach ( $result as $key => $data ) {
			$disabled = ($i == 1) ? true : false;
			$i ++;
			$output [] = array (
					"text" => ltrim ( $data ['LIFNR'], "0" ) . ' - ' . $data ['NAME1'],
					"value" => $data ['LIFNR'],
					"class" => '',
					"disabled" => $disabled,
					"data" => array (
							"subtext" => $data ['NAME1'],
							"icon" => '',
							"content" => '' 
					) 
			);
		}
	}
	
	// $output = array();
	
	
	return $output;
}

/**
 * Main-Program:
 */

// Framework-Engine starten:
load_class ( 'af_engine', 'ajax_public' );
af_engine::start ();

// AJAX-Objekt instanzieren:
$obj_ajax = load_class ( "af_ajax" );

// Übergabeparameter bearbeiten:
if (isset ( $_REQUEST ['op'] )) {
	// den übergabeparameter splitten:
	list ( $op, $ar_args ) = $obj_ajax->filter_args ( $_REQUEST ['op'] );
} else {
	$op = '';
	$ar_args = array ();
}

$obj_ajax->Debug_Message ( 'op: ', $op, $_REQUEST );

// Verarbeitungssteuerung:
switch ($op) {
	case 'get_lfa1' :
		$obj_ajax->json_out = AjaxBootstrapSelectLFA1 ( $_REQUEST );
		break;
	default :
		// JSON-Format:
		$obj_ajax->json_out = '';
		break;
}

// Ausgabe im gewünschten Format:
$obj_ajax->echo_output ();
unset ( $obj_ajax );

?>
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://alaniso-de.gitbook.io/alaf-framework/beispiele/alaf_server_side.php.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
