Hello,
I am a PHP beginner and I made a PHP page which inserts data into a MYSql database.
....
$InsertQuery->Action = "insert";
$InsertQuery->Table = "klanten";
$InsertQuery->bindColumn("Klantnummer", "s", "".strtoupper(((isset($_POST["Klantnummer"]))?$_POST["Klantnummer"]:"")) ."", "WA_DEFAULT");
$InsertQuery->bindColumn("Naam_organisatie", "s", "".strtoupper(((isset($_POST["Naam_organisatie"]))?$_POST["Naam_organisatie"]:"")) ."", "WA_DEFAULT");
$InsertQuery->bindColumn("Adres_organisatie", "s", "".strtoupper(((isset($_POST["Adres_organisatie"]))?$_POST["Adres_organisatie"]:"")) ."", "WA_DEFAULT");
$InsertQuery->bindColumn("Postcode_organisatie", "s", "".strtoupper(((isset($_POST["Postcode_organisatie"]))?$_POST["Postcode_organisatie"]:"")) ."", "WA_DEFAULT");
$InsertQuery->bindColumn("Woonplaats_organisatie", "s", "".strtoupper(((isset($_POST["Woonplaats_organisatie"]))?$_POST["Woonplaats_organisatie"]:"")) ."", "WA_DEFAULT");
$InsertQuery->bindColumn("BTW_plichtig", "s", "".strtoupper(((isset($_POST["BTW_plichtig"]))?$_POST["BTW_plichtig"]:"")) ."", "WA_DEFAULT");
$InsertQuery->bindColumn("Email", "s", "".strtoupper(((isset($_POST["Email"]))?$_POST["Email"]:"")) ."", "WA_DEFAULT");
...
After the insert, I want to send all the data with a mail to a recepient. But I can't find a way to code the "setForm" correctly with the inserted field "Email".
<?php
error_reporting(E_ALL);
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\src\Exception;
require 'PHPMailer\PHPMailer\src\Exception.php';
require 'PHPMailer\PHPMailer\src\PHPMailer.php';
require 'PHPMailer\PHPMailer\src\SMTP.php';
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Host = "smtp.myhosting.be";
$mail->SMTPAuth = true;
$mail->Username = '
[email protected]';
$mail->Password = 'password';
$mail->setFrom = $_POST('Email'); // doesn't work
$mail->AddAddress('
[email protected]');
$mail->Subject = "subject";
$mail->Body = "text"; // in the body I want an overview of all the inserted data
$mail->IsHTML(true);
if(!$mail->Send())
{
echo "Error sending: " . $mail->ErrorInfo;;
}
$mail->ClearAddresses();
$mail->ClearAttachments();
?>
How can I do that?
Thank you in advance for your comments.