How do I connect php to the database of this cadaster? [closed]

0

Theregistrationcodeisthis:

<formclass="register-form">
    <input type="text" placeholder="nome"/>
    <input type="password" placeholder="senha"/>
    <input type="text" placeholder="email"/>
    <button>create</button>
    <p class="message">Already registered? <a href="cadastrando.php">Sign In</a></p>
  </form>
  <form class="login-form">
    <input type="text" placeholder="username"/>
    <input type="password" placeholder="password"/>
    <button>login</button>
    <p class="message">Not registered? <a href="#">Create an account</a></p>
  </form>

I've tried to connect to the database using this command:

<html>

<head>
<title>Cadastrando...</title>
</head>

<body>
<?php
$host = "localhost";
$user = "root";
$pass = "xampp";
$banco = "cadastro";
$conexao = mysql_connect($host, $user, $pass) or die(mysql_errir());
mysql_select_db($banco) or die(mysql_error());
?>

<?php

$nome=$_POST['nome'];
$senha=$_POST['senha'];
$email=$_POST['email'];
$sql = mysql_query("INSERT INTO usuarios(nome, senha, email)
VALUES('$nome', '$senha', '$email')");
?>

</body>
</html>

Being that I created the database all right just does not work. Can anyone help me?

    
asked by anonymous 13.05.2016 / 12:40

1 answer

2

You have to send this form to a page to process the data, consult the database and establish the registration.

<form action="cadastro.php" name="meuForm" method="POST">
...seu form....
</form>

PHP page - cadastro.php In this page, you have to save the data of the fields filled by the user and then consult the database.

You can check this information:
link

    
13.05.2016 / 12:52