<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
use PHPMailer\PHPMailer\SMTP; <- This fixed most of my issues but not always required per Sychro
require 'PHPMailer/Exception.php';
require 'PHPMailer/PHPMailer.php';
require 'PHPMailer/SMTP.php';
$mail = new PHPMailer(true);
if(isset($_POST[‘submit’]))
{ <--- Added Opening
$first_name = ((isset($_POST['FirstName']))&&(!is_null($_POST['FirstName'])))? $_POST['FirstName']:'';
$last_name = ((isset($_POST['LastName']))&&(!is_null($_POST['LastName'])))? $_POST['LastName']:'';
$email = ((isset($_POST['Email']))&&(!is_null($_POST['Email'])))? $_POST['Email']:'';
$age = ((isset($_POST['Age']))&&(!is_null($_POST['Age'])))? $_POST['Age']:'';
$student = ((isset($_POST['Student']))&&(!is_null($_POST['Student'])))? $_POST['Student']:'';
$agree18 = ((isset($_POST['Agree18']))&&(!is_null($_POST['Agree18'])))? $_POST['Agree18']:'';
Note: Hosting Service should provide this infor to you.
----------
$mail->isSMTP();
$mail->SMTPDebug = 2;
$mail->Host = 'mail.email.org';
$mail->SMTPSecure = 'ssl'; <-Could be TLS
$mail->Port = 465; <- Could be 587 or 25
$mail->SMTPAuth = true;
$mail->Username = 'Mail@email.org'; <-To access your Hosting email
$mail->Password = 'Password';
$mail->setFrom('Mail@email.org'); <- From Myself
$mail->addAddress('Mail@email.org'); <-To Myself
$mail->Subject = 'Research Requested';
$mail->isHTML(TRUE);
$mail->Body = '<html> First Name: '.$first_name.' Last Name: '.$last_name.' Email: '.$email.' Age: '.$age.' Student: '.$student.' Agree18: '.$agree18.'
</html>';
$mail->send()
} <--Added Closing
?>
<!DOCTYPE html>
<html lang="en">
<head>
>
</head>
<body>
<div class="container">
<form method="POST" enctype=multipart/form-data action="#"> <--added #
<h4>Want to Learn More? Please fill out the form below.</h4>
<div class="form-group">
<label for="FirstName">First Name:</label>
<input type="text" class="form-control" name="FirstName" id="FirstName" placeholder="First Name" required="">
</div>
<div class="form-group">
<label for="LastName">Last Name:</label>
<input type="text" class="form-control" name="LastName" id="LastName" placeholder="Last Name"required="">
</div>
<div class="form-group">
<label for="Age">How old are you?</label>
<input type="text" class="form-control" name="Age" id="Age" placeholder="Age"required="">
</div>
<div class="form-group">
<label for="Email">Email:</label>
<input type="email" class="form-control" name="Email" id="Email" placeholder="Yes@SModels.org" required="">
</div>
<h4Please Select if your a Student?</h4>
<div><small class="form-text text-muted">
Select all that apply.
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" name="Student" id="Student" value="Yes" >
<label class="custom-control-label" for="Student">Student</label>
</div>
<h4>Please agree to the following:</h4>
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" name="Agree18" id="Agree18" value="Yes" required="" >
<label class="custom-control-label" for="Agree18">I can prove I am 18 years or older. I am legal age to participate according to my country. Proof may be required by law.</label>
</div>
<div><small>
All information will be held strictly confidential in accordance with our disclosure policy which can be requested.
</small></div> <br>
<center>
<div class="submit">
<button type="submit" name="submit" class="btn btn-primary">Send <i class="fa fa-lock"></i></button>
</div>
</center> <br><br><br>
</div>
</form>
</div>