Portus Version 2018-08-24
 

A simple PHP form for accessing Adabas (ex10_SoaGatewaySimpleForm.php)

<?php
/*
 *  On entry to the form determine if the "List Employees" button has been pressed,
 *  if this is the case, retrieve the form field values.
 */
if (isset($_POST['submit'])) {
 $Fname  = $_POST["Fname"];
 $Lname  = $_POST["Lname"];
 $Persid = $_POST["Persid"];
 $City   = $_POST["City"];
}
?>
<html> 
<head> 
<title>Personnel Info</title> 
</head> 
<body>
<font face="courier">
<form method="post" action="<?php echo $PHP_SELF;?>">
Personnel Id: <input type="text" size="8" maxlength="8"   name="Persid" value="<? echo $Persid; ?>"><br />  
First Name..: <input type="text" size="20" maxlength="20" name="Fname"  value="<? echo $Fname; ?>"><br /> 
Last Name...: <input type="text" size="20" maxlength="20" name="Lname"  value="<? echo $Lname; ?>"><br /> 
City........: <input type="text" size="20" maxlength="20" name="City"   value="<? echo $City; ?>"><br />

<br/>
<input type="submit" value="List Employees" name="submit">
</form> 
<?
/*
 *  If the "List Employees" button has been pressed, retrieve the Employees record(s) and format
 *  them into a HTML table. The code used here is, with the exception of the variables used for
 *  building the keys array, equivalent to ex02_SoaGatewayEmpList.php
 */
if (isset($_POST['submit'])) {
 
 echo "Selected: Personnel Id=''".$Persid."'', first_name=''".$Fname."'',Name=''".$Lname;
 echo "'', City=''".$City."''<br/><br/>";

$soapclient = new SoapClient("http://localhost:8022/adabas_EmployeesMini?WSDL");

$key = array(
 'personnel_id' => $Persid,
 'first_name'  => $Fname,
 'name'   => $Lname,
 'city'   => $City
);

$result = $soapclient->list($key);

echo "<table border=1 cellpadding=5>";
echo "<tr><th>Personnel Id</th><th>Name</th><th>first Name</th><th>City</td><td width=200>Address</td></tr>";

if ( isset($result->adabasEmployees->adabasEmployee) )
{
 $Employees = $result->adabasEmployees->adabasEmployee;
 if (!is_array($Employees))
  $Employees = $result->adabasEmployees;

 foreach ($Employees as $Employee) {
  echo "<tr><td>$Employee->personnel_id</td><td>$Employee->name</td><td>$Employee->first_name</td><td>$Employee->city</td><td>";
  echo "<table>";

  if (!is_array($Employee->address_line)) {
   echo "<tr><td width=200>$Employee->address_line</td></tr>";
  } else { 
   foreach ($Employee->address_line as $addr) {
    echo "<tr><td width=200>$addr</td></tr>";
   }
  }
  echo "</table>";
  echo "</td></tr>";
 }

}

echo "</table>";

}
?>

</body></html>

Ostia
www.ostiasolutions.com
Copyright @ 2006-2018 Ostia Software Solutions Limited.