I'm working on a project. A Costumer who visits the company needs to select the employee he has an appointment with. Now if he selects him and presses submit, the employee should get an e-mail with the message that his appointment has arrived.
so i have this :
<form action="mail.php">
<select id="email" name="email">
<?php
//laat de lijst zien van namen van medewerkers, hier zit ook een e-mail aan gekoppeld.
define('Include',TRUE);
require 'database.php';//Needed for database connection
$query= "SELECT employee, email FROM email_register ORDER BY employee ASC";
$result= mysqli_query($db_con, $query);
echo "<option value='' disabled selected>Selecteer uw contactpersoon</option>";
while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)){
$employee=$row["employee"];
$email=$row["email"];
echo " <option>$employee</option>";
}
?>
</select>
<br/></br>
<button type="submit" name="verzenden">Aanmelden</button>
</form>
which selects a person from a database. The table includes: ID, Employee and Email.
then when you press submit, the email which is attached to the person, should go in the following script and send an email. so on the lines of "EMPLOYEE@email.com" and "name employee" the selected data should be filled in. Now someone told me i had to use javascript/jquery. But im not that familiair with those languages since i'm still a newbie
<?php
require 'phpmailer/PHPMailerAutoload.php';
$mail = new PHPMailer;
//$mail->SMTPDebug = 3; // Enable verbose debug output
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = 'smtp-pulse.com'; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = 'EMAIL@gmail.com'; // SMTP username
$mail->Password = 'PASSWORD'; // SMTP password
$mail->SMTPSecure = 'ssl'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = 111; // TCP port to connect to
$mail->setFrom('EMAIL@gmail.com ', 'name sender');
$mail->addAddress('EMPLOYEE-MAIL@mail.com', 'name employee'); // Add a recipient
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = 'Bezoek';
$mail->Body = 'Beste, <br/><br/> some text ment for the employee;
if(!$mail->send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent';
}
?>
so i'm wondering if anyone could help me out. or send me in the right direction