投稿後にメールを送信するポップアップフォームがあります。それはすべて正常に動作します。私は追加するドキュメントの3つのアップロードファイルフィールドを追加しようとしています。私はinput type = "file"を使用しようとしました。私は要求されたように私のコード全体を編集しました。私はメールを送信する下部にコードを追加しました複数の添付ファイルとJavaScript Ajaxリクエストを使用した電子メールの送信
フォームは正常に動作します。私はドキュメントのアップロードのためにこれらの3つのフィールドを欠落しています。
私のjavascript:
<script language="javascript">
function validate(){
var f=document.formED;
if(f.idnumber.value==''){
alert('ID Number is required');
f.idnumber.focus();
return false;
}
/** doing the same for each field => remove here **/
//f.command.value='btn1';
//f.submit();
}
function showHide(){
var f=document.formED;
if(f.fullnames.value==''){
f.fullnames.focus();
return false;
}
/** doing the same for each field => remove here **/
//create an object reference to the div containing images
var oimageDiv=document.getElementById('searchingimageDiv')
//set display to inline if currently none, otherwise to none
oimageDiv.style.display=(oimageDiv.style.display=='none')?'inline':'none'
}
</script>
<div class="col-md-8">
<div class="panel panel-white">
<!-- Removed the irrelevant HTML content for this question -->
<div class="panel-body">
<form onsubmit="return validate()" autocomplete="off" name="formED" action="#" method="post" role="form">
<!-- Removed the irrelevant HTML content for this question -->
<div class="form-group">
<label for="exampleInputEmail1">License Disk Copy:(Please press control while selecting to choose
multiple images)</label>
<input type="file" name="multiple_files[1]" multiple="multiple">
</div>
<div class="form-group">
<label for="exampleInputEmail1">Picture Of Damage:(Please press control while selecting to choose
multiple images)</label>
<input type="file" name="multiple_files[2]" multiple="multiple">
</div>
<div class="form-group">
<label for="exampleInputEmail1">License Copy: (Please press control while selecting to choose
multiple images)</label>
<input type="file" name="multiple_files[3]" multiple="multiple">
</div>
<!-- Removed the irrelevant HTML content for this question -->
<button type="submit" name="newClient" class="btn btn-info" onclick="showHide()">Submit <i
class="fa fa-check" aria-hidden="true"></i></button>
</form>
</div>
</div>
</div>
メールを送信するPHP:
<?php
$to = '[email protected]****';
$subject = "New Assessment Request has been submitted by ".$fullnames;
// Get HTML contents from file
$htmlContent = '<div style="font-family:HelveticaNeue-Light,Arial,sans-
serif;background-color:#FFFFFF"><!-- Removed the irrelevant HTML content for this question -->
</div>';
// Set content-type for sending HTML email
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
// Additional headers
$headers .= 'From: Digiteks Assessment Request<[email protected]****>' . "\r\n";
// Send email
if(mail($to,$subject,$htmlContent,$headers)):
else:
//$errorMsg = 'We are unable to send you a mail, possible your email is a scam..';
endif;
?>
申し訳ございませんが、私はあなたが(メール 'でサーバー – Webdesigner
にフォームを送信する部分)'この意志が表示されません困難な仕事になる。 PHPMailerを試してください(私の答えを見てください)。 – Webdesigner