MySQL blank rows PHP

0

Good morning,

I am forming a php form for a raffle. I have connected my form with the database and everything is correct

My problem is that when I register the data that goes to the database are blank:

I pass the connection code as well (it does not have the connection data for security)

    if (!$db_connection) {
    die('No se ha podido conectar a la base de datos');
}

$subs_email = $_POST['Direccion de Correo'];
$subs_nombre = $_POST['Nombre Completo'];
$subs_facebook = $_POST['Perfil Facebook'];

$resultado=mysql_query("SELECT * FROM ".$db_table_name." WHERE email = '".$subs_email."'", $db_connection);

if (mysql_num_rows($resultado)>0)
{

header('Location: fail.html');

} else {

    $insert_value = 'INSERT INTO '' . $db_name . ''.''.$db_table_name.'' ('email' , 'nombre' , 'facebook') VALUES ("' . $subs_email . '", "' . $subs_nombre . '", "' . $subs_facebook . '")';

mysql_select_db($db_name, $db_connection);
$retry_value = mysql_query($insert_value, $db_connection);

if (!$retry_value) {
   die('Error: ' . mysql_error());
}

header('Location: sucess.html');
}

mysql_close($db_connection);
    
asked by Rafa Alvarez-Ossorio Martin 17.04.2017 в 19:08
source

1 answer

0

I'm not sure you can have spaces when you receive your variables:

$subs_email = $_POST['Direccion de Correo'];
$subs_nombre = $_POST['Nombre Completo'];
$subs_facebook = $_POST['Perfil Facebook'];

You should modify where you send with underscores to receive them like this:

$subs_email = $_POST['Direccion_de_Correo'];
$subs_nombre = $_POST['Nombre_Completo'];
$subs_facebook = $_POST['Perfil_Facebook'];
    
answered by 17.04.2017 / 19:30
source