0
I was trying to make the connection to the database, but the bank is only saving the ID user’s.
{$con = mysql_connect("localhost","root", "");
mysql_select_db("cadastro",$con);
$nome = $_POST['nome'];
$email = $_POST['email'];
$senha = $_POST['senha'];
$tdc = $_POST['tdc'];
$sql = mysql_query("INSERT INTO tb_usuarios(nome_usuario, email_usuario, senha_usuario, tdc_usuario) VALUES ('$nome', '$email', '$senha', '$tdc')");
?>}
After registration is giving these mistakes:
{Notice: Undefined index: nome in C:\xampp\htdocs\Controla\cadastrando.php on line 19 Notice: Undefined index: email in C:\xampp\htdocs\Controla\cadastrando.php on line 20 Notice: Undefined index: senha in C:\xampp\htdocs\Controla\cadastrando.php on line 21 Notice: Undefined index: tdc in C:\xampp\htdocs\Controla\cadastrando.php on line 22}
HTML:
<html>
<meta charset="utf-8">
<head>
<title>Controla</title>
<link rel="stylesheet" type="text/css" href="estilocadastro.css">
<link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Fjalla+One" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Raleway" rel="stylesheet">
</head>
<body>
<div class="small"></div>
<div class="medium"></div>
<div class="large"></div>
<form name="sign" method="POST" action="cadastrando.php">
<header id="cabecalho">
<div class="interface">
<img id="Logo" src="imagens/controla.png" style="width:350px; height:355px; margin-left: 51%;">
</header>
<div class="menu">
<ul>
<li><a href="#">Página Inicial</a></li>
<li><a href="login.php">Login</a></li>
<li><a href="Cadastro.php">Cadastrar</a></li>
<li><a href="#">Minha Conta</a></li>
</ul>
</div>
<div class="central" style="z-index: 99999;top: 4em;"><br>
<h1>CADASTRE - SE</h1>
</div>
<form action="cadastrando.php" method="POST">
<section>
<label style="font-family: 'Fjalla One'; color: #ffffff;">Nome Completo</label><br>
<input type="text" name="nome"><br>
<label style="font-family: 'Fjalla One'; color: #ffffff;">Email</label><br>
<input type="text" name="email"><br>
<label style="font-family: 'Fjalla One'; color: #ffffff;">Senha</label><br>
<input type="password" name="senha"><br>
<label style="font-family: 'Fjalla One'; color: #ffffff;">Tipo de comércio</label><br>
<input type="text" name="tdc"><br><br>
<a href="cadastrando.php"><img src="imagens/Botão.png" style="margin-left: -2px; margin-top: -1em; cursor: pointer;"></a>
</section>
</form>
<footer id="sobre">
<p> © Controla Estoque 2018</p>
<h5 style="margin-left: -7.9em;position: relative;"> Um sistema de controle de estoque adequável para comercio de pequenas e microempresas, sendo padaria, pet shop, papelaria entre outros comércios existentes.</h5>
</footer>
</form>
</body>
</html>
If possible edit your question and post your HTML code.
– Valdeir Psr
the connection with the bank ta ok, but what is giving error is that it is not recognizing the variables, and I can not post the Tagas in html.
– Matheus Pellegrini
This function
mysql*
is obsolete, instead of usingmysqli
orPDO
. https://imasters.com.br/banco-dados/mysql/mysql-obsoleto-utilize-funcoes-mysql_/? trace=1519021197&source=single– Vinícius Lima
i am using php 5.6
– Matheus Pellegrini
php 5.6 has the
mysqli
, and PDO for Mysql as well. After all, 5.6 is one of the latest versions of PHP. Only recommendation, we are not forcing you, but should not use obsolete and deprecated functions.– Vinícius Lima
to making tcc project brother, I’m using php 5.6 thanks for the teachers.
– Matheus Pellegrini