..........
...........
$otch=$row['otchestvo'];
..............
...................
$dolgnost=$row['dolgnost'];
if($action=="form_action")//start Формирование документа подставляем в нужные блоки информацию
{
$output = str_replace( "<item>name</item>", $name, $output );
$output = str_replace( "<item>lastname</item>", $lastname, $output );
$output = str_replace( "<item>otchestvo</item>", $otch, $output );
$output = str_replace( "<item>otdel</item>", $otdel, $output );
$output = str_replace( "<item>dolgnost</item>", $dolgnost, $output );
$output = str_replace( "<item>d_tek</item>", date("d.m.Y"), $output );
if($dop!=$count)// вставляем дополнительные блоки если записей больше чем одна
{
for($l=0;$l<count($out1);$l++)
{
$output = preg_replace('|</block_text_'.($l+1).'>|Uis',$out1[$l][0],$output);
}
}
$dop++;
}//end
}
if($action=="form_action")//start сохраняем документ в файл
{
for($l=0;$l<count($out1);$l++)
{
$output = str_replace( "<block_text_".($l+1).">", "", $output );
$output = str_replace( "</block_text_".($l+1).">", "", $output );
}
$d=time();
$file = "docs_user/".$d.".rtf";
$fp = fopen ($file, "w" );
fwrite($fp, $output);
fclose ( $fp );
}//end