HEX
Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.30
System: Linux iZj6c1151k3ad370bosnmsZ 3.10.0-1160.76.1.el7.x86_64 #1 SMP Wed Aug 10 16:21:17 UTC 2022 x86_64
User: root (0)
PHP: 7.4.30
Disabled: NONE
Upload Files
File: //var/www/html/inventory.breadsecret.com/view/template/emailform.php
<?php
include("view/layout/meta.php");
include("view/layout/head.php");
?>
<main class="content">
<div class="funcBar d-flex text-white">
    <span class="funcTitle mr-auto">Warehouse Email To List</span>
    <div class="funcMenu mx-3 py-2">
        <a class="btn" href="<?php Utility\WebSystem::path($request->referer(Requests\Request::REFERER_QUERY), true, false);?>" data-toggle="tooltip" data-placement="bottom" title="Back"><i class="fas fa-1x fa-list-alt"></i></a>
    </div>
</div>
<form id="form-email" class="container my-3">
	<h2>Email To List</h2>
	<h6>If no item, Default Email to: <?=cfg('system')['warehouseEmailTo'];?></h6>
	<div id="emailList">
<?php
$stm = Database\Sql::select('warehouseEmailAddr')->prepare();
$stm->execute();
foreach ($stm as $idx => $row) {
   $this->input('Email Address '.($idx + 1), 'emailAddr[]', 'emailAddr'.($idx + 1), 'text', '', $row['emailAddr']);
}
$this->input('Email Address '.($stm->rowCount() + 1), 'emailAddr[]', 'emailAddr'.($stm->rowCount() + 1), 'text');
?>
	</div>
    <div class="form-group row mx-0">
        <div class="offset-md-4">
            <button type="button" class="btn btn-success" id="btnAddEmail">+ Add More Email Address</button>
        </div>
    </div>
<?php
$this->submit('Save');
?>
</form>
</main>
<?php
include("view/layout/foot.php");
include("view/layout/js.php");
?>
<script>
	$('#btnAddEmail').click(function (e) {
		var count = $('#emailList>div').length;
		var emailField = [
			'<div class="form-group row mx-0">',
			'<label for="emailAddr', count + 1, '" class="col-md-4 p-0 px-md-3">Email Address ', count + 1, '</label>',
			'<input type="text" class="form-control col-md-8" id="emailAddr', count + 1, '" name="emailAddr[]" value="" >',
			'</div>',
		].join('');
		$('#emailList').append(emailField);
	});
    $('#form-email').submit(function (e) {
        var data = new FormData(this);
        ajaxFunc.apiCall("POST", "template/saveEmail", data, "multipart/form-data", ajaxFunc.responseHandle);
        e.preventDefault();
    });
</script>
<?php
include("view/layout/endpage.php");
?>