Hello
I am new to PHP and am working on an exercise but is not working, the problem is that is not inserting the data in to mysql database.
When enter the user and password in the html page runs and give no problems, get no errors.
In MySQL one table created with: ID, NOMBRE, PW
Linux OS OpenSuse 13.1 / localhost
Apache 2.4.6
Database Server version 5.5.33-MariaDB
Database client version mysqlnd 5.0.10
PHPMyAdmin 4.1.14
Attached is a screenshot of the PHPMyAdmin table.
This is my index dot php
<!DOCTYPE>
<html>
<head>
<title> Insertar Nombre Password </title>
</head>
<body>
<form action="insertar.php" method="post" name="form">
<input type="text" name="nombre" /><br /><br />
<input type="password" name="pw" /><br /><br />
<input type="submit" value="insertar datos" />
</form>
</body>
</html>
insertar dot php
<?php
//Include another script in this one.
include("conexion.php");
if(isset($_POST['nombre']) && !empty($_POST['nombre']) &&
isset($_POST['pw']) && !empty($_POST['pw']))
{
//Connect to the database
$con = mysql_connect($host,$user,$pw)or die("problemas al conectar");
mysql_select_db($db,$con)or die("problemas al conectar la bd");
mysql_query("INSERT INTO CodigoF (NOMBRE,PW) VALUES ('$_POST[nombre]','$_POST[pw]')",$con);
echo "datos insertados";
}
else {
echo "problemas al insertar datos";
}
?>
conexion dot php
<?php
$host = "localhost";
$user = "root";
$pw = "Fafa1669";
$db = "CodigoFacilito";
?>
Hope some one can guide me in the right direction, thank you.