-1
I tried that way but of the undifined index.
php-based.
<?php
$conexao=mysqli_connect('localhost', 'root','','formulario');
mysqli_set_charset($conexao,'utf');
if ($conexao->connect_error) {
die("Falha ao efectuar ligação: ".$conexao->connect_error);
}
?>
php sending.
<?php
include "basededados.php";
if(isset($_POST['upload'])){
$nome = $_POST['nome'];
$processo=$_POST['processo'];
$email = $_POST['email'];
$disciplina=$_POST['disciplina'];
$sql= "INSERT INTO dados VALUES ('','$nome','$processo','$email','$disciplina')";
mysqli_query($conexao, $sql);
}
?>
<?php
include "basededados.php";
$mailto = $_POST['mailto'];
$mailSub = $_POST['mailsub'];
$id = $_GET['id'];
$escola=$_POST['escola'];
$nome = $_POST['nome'];
$processo=$_POST['processo'];
$disciplina=$_POST['disciplina'];
require 'PHPMailer-master/PHPMailerAutoload.php';
$mail = new PHPMailer();
$mail ->IsSmtp();
$mail ->SMTPDebug = 0;
$mail ->SMTPAuth = true;
$mail ->SMTPSecure = 'ssl';
$mail ->Host = "smtp.gmail.com";
$mail ->Port = 465; // or 587
$mail ->IsHTML(true);
$mail ->Username = "[email protected]";
$mail ->Password = "password";
$mail ->SetFrom("[email protected]");
$mail ->Subject = $mailSub;
$mail ->Body='<h2>$id.Escola: '.$_POST['escola'].'<br>Nome: '.$_POST['nome'].'<br>Processo: '.$_POST['processo'].'<br>Email: '.$_POST['email'].'<br>Disciplina: '.$_POST['disciplina'].$id.'</h2>';
$mail ->AddAddress($mailto);
if(!$mail->Send())
{
echo "Pedido não foi enviado.<br>";
}
else
{
echo "Pedido enviado com sucesso!<br>";
}
$mail->ClearAddresses();
?>
You want the Insert ID you just made and put in the email?
– Leonardo Barros
yes but I’m having a hard time calling you
– AvicT
If the error is "Undefined index" you are accessing a position that does not exist from an array and has no relation to the connection to the database or sending email. It manages to elaborate a [mcve]?
– Woss
now ta appearing Undefined variable
– AvicT
In relation to this notice
undefined
This link might help you Variable errors at the beginning of PHP– Icaro Martins