Why did you assign the same value two times?
$ime_inputa = ($tip == 'submit') ? '' : $ime_inputa = $ime;
I fixed as follow:
$ime_inputa = ($tip == 'submit') ? '' : $ime;
No definition of the variable $k.
if($k == 'Potrdi') {
The variable $ime seems to be a valid variable.
if($ime == 'Potrdi') {
The following line does not apply.
$polje .= $obvezna_polja[$i];
This piece of code does not work because you prepend the subsequent values ​​to the variable $ime_post.
...
$ime_post .= $ime;
...
if($obvezna_polja[$i] == $ime_post){ // that wont work, dont know why?
if($_POST[$ime_post] == ''){
echo "obvezno polje";
} else {
echo "stima";
}
}
When you create an array like this, the problem is resolved.
$ime_post = array();
$vrednost_post = array();
foreach ($ime_post as $k=>$v) {
if ($obvezna_polja[$i] == $v){
if($_POST[$v] == ''){
echo "obvezno polje";
} else {
echo "stima";
}
}
}
That's all.