I am making a project about a webpage where you can sign in and after that login.
I started trying to make a form that save user's information, you know, something simple, I made the database, the connection using php, the server's user and password and all those things, and it doesn't work! I tried everything (I think) and it didn't work, also showing me the classic "Error 500".
I want to share my PHP code with so you can see what's my problem:
<?php
//Connecting with server
$conexion = mysql_connect('localhost', '<username>', '<password>');
//verificar conexi贸n
if(!$conexion){
echo"No se conect贸 con servidor.";
}else {
$conexiondb = mysql_select_db('hermanos_Hashem');
if(!$conexiondb){
echo"No se conect贸 con base de datos.";
}
}
// information
$user = $_POST['user'];
$correo = $_POST['correo'];
$pass = $_POST['pass'];
$tel = $_POST['tel'];
$genero = $_POST['genero'];
$pais = $_POST['pais'];
$fav = $_POST['fav'];
$sobremi = $_POST['sobremi'];
//saving
$guardar = "INSERT INTO usuarios VALUES(
'$user',
'$correo',
'$pass',
'$tel',
'$genero',
'$pais',
'$fav',
'$sobremi'
)";
$ejecutar = mysql_query($guardar);
if(!$ejecutar){
echo"Error al llenar formulario.";
}
else {
echo"datos guardados correctamente. <a href="www.google.com"> Volver </a> " ;
}
?>