2
I have a HTML
with that code:
<div class="row">
<form method="post" action="php/mensagem.php" accept-charset="utf-8">
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
<input class="col-lg-12 col-md-12 col-sm-12 col-xs-12" name="nome" placeholder="Nome" type="text" required>
<input class="col-lg-12 col-md-12 col-sm-12 col-xs-12" name="email" placeholder="E-mail" type="email" required>
<input class="col-lg-12 col-md-12 col-sm-12 col-xs-12" name="telefone" placeholder="Telefone" type="text" maxlength="9" required>
</div>
<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
<textarea class="input-xlarge col-lg-12 col-md-12 col-sm-12 col-xs-12" id="message" name="mensagem" placeholder="Mensagem" rows="6" required> </textarea>
</div>
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
<button class="btn btn-primary" type="reset" style="float:left;">Apagar</button>
</div>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
<input type="submit" class="btn btn-primary" value="Enviar" style="margin-top:-39px; float:right"/>
</div>
</div>
</div>
</form>
</div>
that sends to PHP
that you keep in your comic book. with that code:
<php>
$con = mysqli_connect("localhost","root","","saber");
$nome = $_POST['nome'];
$mail = $_POST['email'];
$tlm = $_POST['telefone'];
$msn = $_POST['mensagem'];
$vista = 0;
$sql = "insert into mensagem(nome,mail,telefone,mensagem,vista) values ('$nome','$mail','$tlm','$msn',$vista)";
if(mysqli_query($con, $sql)){
echo "<script>
alert('Mensagem enviada');
document.location.href = 'index.html';
</script>";
}
else{
echo "<script>
alert('Mensagem não enviada');
document.location.href = 'index.html';
</script>";
}
?>
And when I click on Submit instead of inserting and returning to the index only appears the code
And what appears from the Alert?
– Jorge B.
nothing appears only php code
– Bruno Gibellino