I have the following code:
<?php require_once ("cabecalho.php");?>
<div id="menor">
<div class="input-field col s12">
<form action="envia-texto.php" method="post">
<div id="texto" name="texto">
<h5 class="center-align black-text"><?php ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
if(isset($_POST['titulo'])){
echo $_POST['titulo'] . ' ';
}?>
</h5><br>
<h6 class="black-text">
<?php ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
if(isset($_POST['introducao'])) {
echo $_POST['introducao'] . ' ';
}?>
</h6>
<h6 class="black-text">
<?php ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
if(isset($_POST['argumento1'])) {
echo $_POST['argumento1'] . ' ';
}?>
</h6>
<h6 class="black-text">
<?php ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
if(isset($_POST['argumento2'])) {
echo $_POST['argumento2'] . ' ';
}?>
</h6>
<h6 class="black-text">
<?php ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
if(isset($_POST['argumento3'])) {
echo $_POST['argumento3'] . ' ';
}?>
</h6>
<h6 class="black-text">
<?php ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
if(isset($_POST['conclusao'])) {
echo $_POST['conclusao'] . ' ';
}?>
</h6>
</div>
<div class="input-field">
<input class="validate" id="nome" type="text" name="nome">
<label for="nome" class="black-text">Nome Completo</label>
</div>
<div class="input-field">
<input class="validate" id="email1" type="email" name="email1">
<label for="email1" class="black-text">Seu Email</label>
</div>
<div class="input-field">
<input type="password" name="senha" id="senha">
<label for="senha" class="black-text">Sua Senha</label>
</div>
<div class="input-field">
<input class="validate" id="email2" type="email" name="email2">
<label for="email2" class="black-text">Email Alvo</label>
</div>
</div>
<div class="row">
<div class="col s12 center">
<br>
<button class="btn waves-effect waves-light red" value="Enviar2" type="submit">
<i class="material-icons right">send</i>enviar
</button>
</div>
</div>
</form>
</div>
<?php include 'rodape.php';?>
When you click the submit button, the code enviar-texto.php
is loaded, which is the
<?php
session_start();
$texto = $_POST["texto"];
$email2 = $_POST["email2"];
$email1 = $_POST["email1"];
$senha = $_POST["senha"];
$nome = $_POST["nome"];
require_once("PHPMailerAutoload.php");
$mail = new PHPMailer();
$mail->isSMTP();
$mail->CharSet = 'utf-8';
$mail->Host = 'smtp.gmail.com';
$mail->Port = 587;
$mail->SMTPSecure = 'tls';
$mail->SMTPAuth = true;
$mail->Username = $email1;
$mail->Password = $senha;
$mail->setFrom($email1, $nome);
$mail->addAddress($email2);
$mail->Subject = "Redação de um usuário VestCollege";
$mail->msgHTML("<html>{$texto}</html>");
$mail->AltBody = $texto;
if($mail->send()) {
header("Location: home.php");
} else {
$_SESSION["danger"] = "Erro ao enviar mensagem " . $mail->ErrorInfo;
header("Location: phptexto.php");
}
die();
It works like this: the fields title, introduction, argument 1, etc. are filled in. Then these pieces are joined and loaded into the "text" div, but when I send the email the div goes empty and I do not know what the problem is.
If it's relevant to say I'm using materialize css framework. Please help me, because I do not know what to do.