Database does not receive querys for php script although it works

0

I have a problem with receiving the form in the database, it seems that although the script is correct it simply ignores it, so using xampp, I tried cloud9 too and the same thing happens.

<?php
include 'connection.php';

$name = $sbname = $sex = $age = $nasc = $email = $site = "";

if (isset($_POST['enviar'])){

$name = $_POST['form_nm'];
$sbname = $_POST['form_sobnm'];
$sex = $_POST['form_sex'];
$age = $_POST['form_age'];
$nasc = $_POST['form_nasc'];
$email = $_POST['form_email'];
$site = $_POST['form_site'];

$query = "INSERT INTO pessoas(nome, sobrenome, sexo, idade, nascimento, 
email, website) VALUES ($name, $sbname, $sex, $age, $nasc, $email, $site)";
mysqli_query($link,$query);
}
header('location:../index.php');
?>

the connection:

    <?php

    $data = parse_ini_file("config.ini");

    $link = mysqli_connect($data['host'], $data['username'], 
    $data['password'], $data['database']);

    if(mysqli_connect_error()){
        die("Unable to connect to database! Error: " . 
    mysqli_connect_error());
    }

    ?>

and config.ini:

    [SERVER_DATA]

    host = 'localhost';
    username = 'root';
    password = '';
    database = 'atividade_ecomp';

Everything is correct, I've reviewed it several times, the database, the table and the columns are with the correct names, I'm using phpMyAdmin but even after sending the form the database does not add the information.

    
asked by anonymous 07.05.2018 / 00:53

0 answers