the code is:
<?php
ini_set('display_errors',1);
error_reporting(E_ALL);
if(isset($_POST['submit'])){
$c=0;
foreach($_POST['inlocuitor'] as $sir){
$inlocuitor[$c]=$sir;
$c++;
}
$sursa=file_get_contents('C:\xampp\htdocs\sablon.html');
$n=strlen($sursa);
$i=0;$j=0;
while($i<$n)
{
if(($sursa[$i]=="#")&&($sursa[$i+1]=="%"))
$poz1=$i;
if(($sursa[$i]=="%")&&($sursa[$i+1]=="#")){
$poz2=$i+1;
$template[$j]=substr($sursa,$poz1,$poz2);
$j++;
}
$i++;
}
$sursa=file_get_contents('C:\xampp\htdocs\sablon.html');
$sursa=stripslashes($sursa);
for($i=0;$i<$j;$i++)
$sursa=str_replace($template[$j],$inlocuitor[$j],$sursa);
$fp=fopen("C:\\xampp\\htdocs\\{$_POST['nume_pagina']}.html",'a+');
fwrite($fp,"$sursa\r\n");
fclose($fp);
}
?>
and the error is:Notice: Undefined offset: 2 in C:\xampp\htdocs\generare.php on line 27, which means that there probably is a problem with this line: $sursa=str_replace($template[$j],$inlocuitor[$j],$sursa);