3
I have this HTML code
<!DOCTYPE html>
<HTML>
<HEAD>
<TITLE>Cadastro</TITLE>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="css/bootstrap.css">
</HEAD>
<BODY>
<div class="container">
<form method="POST" class="form-horizontal" action="teste.php">
<div class="form-group">
<label for="pesNome" class="col-sm-2 control-label">Nome</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="pesNome" placeholder="Nome">
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-default">Gravar</button>
</div>
</div>
</form>
</div>
</BODY>
</HTML>
And this PHP code
<!DOCTYPE HTML>
<html>
<link rel="stylesheet" type="text/css" href="css/bootstrap.css">
<?php
$nome=isset($_POST['pesNome']);
var_dump($nome);
?>
<a href="index.php">voltar</a>
</html>
My intention is that the var_dump
return what was typed in the input pesName, but instead returns me the message bool(false)
.
Can anyone explain to me why ?
I know. You’re doing
$nome=isset($_POST['pesNome']);
, then the value of$nome
will be the return ofisset
, that checks if a certain value exists. And remember to define the attributename
in the form fields.– Woss
The input
<input type="text" class="form-control" name="pesNome" id="pesNome" placeholder="Nome">
return value is by input name$nome=$_POST['pesNome'];
– user60252
Thanks, the problem was actually the name attribute. The isset I had actually put as a test after I played the post and returned me an error that there was no such thing. I thought the post caught the name in the id. Valeu!!!
– w.rock