2
So, I started recently with php and tried to do a simple crud with php+mysql but, I had a problem that I believe is the connection with mysql. when loading the action (action) into html, the page is empty. Returns no error and inserts it into the database. Follow the script below:
<form class="central text" name="cadastro" method="post" action="cadastro.php">
<div>
<h2>Dados Pessoais</h2>
<p>Primeiro Nome</br><input type="text" name="primeiroNome"></p>
<p>Sobrenome</br><input type="text" name="sobrenome"></p>
<p>Nascimento</br><input type="date" name="nascimento"></p>
<p>Nacionalidade</br><input type="text" name="nacionalidade"></p>
</div>
<input name="salvar" type="submit" value="Salvar">
</form>
The simple test, just to know if it is connecting. It is without the insertion query in the database, because it does not even pass this connection line:
<?php
$conexao = mysql_connect ("localhost", "root", "")
echo "Conectado!";
or die("Não conectado ao banco! Erro: ".mysql_error());
?>
I thank anyone who can help. Just for the record: 1-Yes, to get here and ask someone, I researched a lot! 2-I’m using Linux (LAMP)
It worked! Thank you very much. Everywhere I researched, taught the way I was doing. But anyway, thank you very much!
– Lord Voldemort