//this is the function on file.php function nomes_comerciais() { $query = "SELECT * FROM comerciais ORDER BY nome asc"; $resultado = mysql_query($query) or die( mysql_error() ); while($linha = mysql_fetch_array($resultado)){ print( ""); } } //then on index.php i make a require of file.php (wich is the file with the insert query too and the select is like this: Comercial Angariador:
//on the query i'm putting $_POST['comercial-ang'] but it's not inserting on the db