Greetings!
I have what I guess is a simple problem with a simple php code. What I want, is that with a simple form, the name and the password that are entered, are saved in a database. I have a form, and the action ="Process_Form.php" calls this file. Then, with $_POST array I can retrieve the data. With these data saved in variables, I want to move them to a database. Here's the problem. I'll show you both codes, and I hope you can see the mistake.
Code from the form:
<?
echo "<form id='form1' name='form1' method='post' action='Procesar_Orden.php'>
<label>Usuario
<input type='text' name='Usuario' id='Usuario' />
Contraseña
<input type='text' name='Contraseña' id='Contraseña' />
</label>
<label>
<input type='submit' name='Submit' id='Submit' value='Submit' />
</label>
</form>";
?>
Code from the php script that tries to save the data in a db:
<?
$Usuario = $_POST['Usuario'];
$Contraseña = $_POST['Contraseña'];
$dbname = "Freevids";
$usrname = "root";
$psswd = "asdfghjkl9";
$host = "localhost";
$Die_message = "No se ha podido conectar con la base de datos";
$Conexion = mysqli_connect($host,$usrname,$psswd,$dbname) or die($Die_message);
$Query = "INSERT INTO Usuarios VALUES ('Hola', 'Buuu')";
if (mysqli_query($Conexion,$Query))
{
echo "El usuario ha sido incluido exitosamente en la base de datos";
}
else
{
echo "No se ha podido agregar el usuario a la base de datos.";
}
?>
The result of all of this is "No se ha podido agregar el usuario a la base de datos." which is the message It displays when the info couldn't be added. Please help! Thanks!