0
을 통해 값. 메일이 전송되었습니다. 그러나 선택된 값을 보내는 대신 목록의 모든 값을 보냅니다. 나는 실종 된 것을 찾을 수 없다. 제발 제안 해주세요.보내는 여러 확인란 PHPmailer
는 지금까지 내가 본 나는 거기에 어떤 오류가 발생하지 않았다. 하지만 문제는 의사 소통 부분에 있다고 생각합니다. 3) JQuery와 4) PHP 5)
PHPMailer
어떤 해결책을 제안 해주십시오 스크립트 1) HTML 2)를 사용하여 구축.
는var address = document.getElementById('faddress');
var optiona = document.getElementById('optiona');
var optionb = document.getElementById('optionb');
var optionc = document.getElementById('optionc');
var optiond = document.getElementById('optiond');
var optione = document.getElementById('optione');
var optionf = document.getElementById('optionf');
var optiong = document.getElementById('optiong');
var optionh = document.getElementById('optionh');
var optioni = document.getElementById('optioni');
var optionj = document.getElementById('optionj');
var sectiona = document.getElementById('sectiona');
function checkErrors(){
var error_count = 0;
if(error_count == 0){
document.getElementById('container').innerHTML = "<div class='thank_con'><div class='thankyou'><h2>Thank You</h2><p>We will get back to you shortly.</p><a href='https://www.google.co.uk/' target='_blank'><img src='viewsite.png' class='imgcls'></a></div> </div>";
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
if(this.responseText == "OKAY"){
}
}
};
xhttp.open("GET", "comm.php? address="+address.value+"&optiona="+optiona.value+"&optionb="+optionb.value+"&optionc="+optionc.value+"&optiond="+optiond.value+"&optione="+optione.value+"&optionf="+optionf.value+"&optiong="+optiong.value+"&optionh="+optionh.value+"&optioni="+optioni.value+"&optionj="+optionj.value+"§iona="+sectiona.value);
xhttp.send();
}
}
document.getElementById("submit_button").addEventListener("click", function(){
checkErrors();
});
<form method="POST" name="contactform" action="contact-form-handler.php">
<input class="form-check-input " type="checkbox" name="optiona" id="optiona" value="ESOL - National 3: Ayr">
<input class="form-check-input " type="checkbox" name="optionb" id="optionb" value="ESOL - National 4: Kilmarnock/Kilwinning">
<input class="form-check-input " type="checkbox" name="optionc" id="optionc" value="ESOL - National 5: Ayr/Kilmarnock">
<input class="form-check-input " type="checkbox" name="optiond" id="optiond" value="ESOL - Higher: Ayr/Kilmarnock">
<input class="form-check-input " type="checkbox" name="optione" id="optione" value="PEZ: Ayr/Kilmarnock/Kilwinning">
<input class="form-check-input " type="checkbox" name="optionf" id="optionf" value="PEZ Plus: Ayr/Kilmarnock/Kilwinning /Cumnock">
<input class="form-check-input " type="checkbox" name="optiong" id="optiong" value="Step Into Employment: Kilwinning">
<input class="form-check-input " type="checkbox" name="optionh" id="optionh" value="Step Into Youthwork: Ayr">
<input class="form-check-input " type="checkbox" name="optioni" id="optioni" value="Twenty Four/Seven Plus: Ayr/Kilmarnock/Kilwinning">
<input class="form-check-input " type="checkbox" name="optionj" id="optionj" value="Princes Trust (Feb 18 start): Ayr/Kilmarnock/Kilwinning">
<input class="form-check-input " type="checkbox" name="sectiona" id="sectiona" value="Introduction to Business and Computing: Kilwinning">
<input type="text" class="textbx form-control" name="faddress" id="faddress" placeholder="Enter your email">
<button type="submit" name="submit" class="subsc" id="submit_button"></button>
</form>
Comm.php
<?php
date_default_timezone_set("America/New_York");
require 'PHPMailer/PHPMailerAutoload.php';
class MyDB extends SQLite3 {
function __construct() {
$this->open('south_bay.sqlite');
}
}
$address = $_GET['address'];
$optiona = $_GET['optiona'];
$optionb = $_GET['optionb'];
$optionc = $_GET['optionc'];
$optiond = $_GET['optiond'];
$optione = $_GET['optione'];
$optionf = $_GET['optionf'];
$optiong = $_GET['optiong'];
$optionh = $_GET['optionh'];
$optioni = $_GET['optioni'];
$optionj = $_GET['optionj'];
$sectiona = $_GET['sectiona'];
$monthNum = date("m");
$dateObj = DateTime::createFromFormat('!m', $monthNum);
$monthName = $dateObj->format('F');
$date = $monthName.date("-d-Y").' '.date("h:i:s A");
$mail = new PHPMailer();
$body = "<h1>Here are your customer details</h1>
<table border='1'>
<tr>
<td><p><strong> EMAIL ADDRESS: </strong>$address</p></td>
</tr>
<tr>
<td><p><strong> PARTNERSHIP AND EMPLOYABLITY COURSES - CAMPUS LOCATION</strong></p></td>
</tr>
<tr>
<td><p>$optiona</p></td>
</tr>
<tr>
<td><p>$optionb</p></td>
</tr>
<tr>
<td><p>$optionc</p></td>
</tr>
<tr>
<td><p>$optiond</p></td>
</tr>
<tr>
<td><p>$optione</p></td>
</tr>
<tr>
<td><p>$optionf</p></td>
</tr>
<tr>
<td><p>$optiong</p></td>
</tr>
<tr>
<td><p>$optionh</p></td>
</tr>
<tr>
<td><p>$optioni</p></td>
</tr>
<tr>
<td><p>$optionj</p></td>
</tr>
<tr>
<td><p><strong> BUSSINESS AND COUMPUTING</strong></p></td>
</tr>
<tr>
<td><p>$sectiona</p></td>
</tr>
</table>";
$mail->SMTPDebug = 0; // enables SMTP debug information (for testing)
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPSecure = "ssl"; // sets the prefix to the servier
$mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server
$mail->Port = 465; // set the SMTP port for the GMAIL server
$mail->SMTPKeepAlive = true;
$mail->Mailer = "smtp";
$mail->Username = "[email protected]"; // GMAIL username
$mail->Password = "welcome$123"; // GMAIL password
$mail->AddAddress('[email protected]');
$mail->AddAddress('[email protected]');
$mail->SetFrom('[email protected]');
$mail->Subject = 'Contact Form';
$mail->AltBody = 'To view the message, please use an HTML compatible email viewer!'; // optional - MsgHTML will create an alternate automatically
$mail->MsgHTML($body);
$mail->Send();
echo "OKAY";
?>
내가 제출 '버튼을 입력하면. 메일이 전송되었습니다. 그러나 선택된 값을 보내는 대신 목록의 모든 값을 보냅니다. 나는 실종 된 것을 찾을 수 없다. 제발 제안 해주세요.
는 지금까지 내가 본 나는 거기에 어떤 오류가 발생하지 않았다. 하지만 문제는 의사 소통 부분에 있다고 생각합니다. 3) JQuery와 4) PHP 5)
PHPMailer
어떤 해결책을 제안 해주십시오 스크립트 1) HTML 2)를 사용하여 구축.
는 ** 감사합니다 ** 그것은 간단한 배열 방식으로 일했다. –