look , i have create this code at php page called "func_selects.php".
<?php
require('functions.php');
impressoras();
$result = impressoras();
function call(){
$imp_select = "";
foreach( $result as $imp){
$imp_select .= '<option value="'.$imp['nome'].'">'.$imp['nome'].'</option>';
}
return $imp_select;
}
?>
remember that result came from a another page called "functions.php" that run a PDO Query that return in array .
But for example , how u can see , my code above only create some options .
i wanna create a another page , for example called "index.php" where i'll execute that function.
for example
"f0.php"
<?php
require('func_selects.php');
call();
$imp_select = call();
?>
<html>
<body>
<script type="text/javascript">
call();
</script>
<select name="kakaka" class="form-control"><option
value="2">sdsdsds</option><option value="talvez"><?php echo $imp_select ?>
</option></select>
</body>
</html>
but dont return nothing , someone could help me ?
Getting these errors
Notice: Undefined variable: result in /var/www/tkclientespdo/func_selects.php on line 10
Warning: Invalid argument supplied for foreach() in /var/www/tkclientespdo/func_selects.php on line 10