Thứ Tư, 10 tháng 6, 2026

Icon trong select css đẹp

**** HTML



<div class="select-wrap">

    <select name="customer_shipping_phuongxa" id="customer_shipping_phuongxa">

        <option value="">Chọn Phường / Xã</option>

    </select>

</div> 

**** CSS
.appline .select-wrap{

    position:relative;

    width:100%;

}

.appline .select-wrap select{

    -webkit-appearance:none;

    -moz-appearance:none;

    appearance:none;


    background:#fff;

    border:1px solid #d9d9d9;

    box-sizing:border-box;

    border-radius:16px !important;

    height:40px !important;

    width:100%;

    padding:5px 45px 5px 20px !important;

    transition:all .2s;

    font-size:14px;

    cursor:pointer;

}

.appline .select-wrap select::-ms-expand{

    display:none;

}

.appline .select-wrap:after{

    content:"";

    position:absolute;

    top:50%;

    right:18px;

    margin-top:-2px;

    width:0;

    height:0;

    border-style:solid;

    border-width:5px 4px 0 4px;

    border-color:#888 transparent transparent transparent;

    pointer-events:none;

}

Thứ Tư, 27 tháng 5, 2026

htmlspecialchars show hết lỗi dấu nháy - bird" s

$title_en="bird's nest products";

<input class="form-control" id="txt_name_en" name="txt_name_en" placeholder="Tên sản phẩm - Tiếng anh (*)" value="bird" s="" nest="" products'="" maxlength="80" required="">

và sử dụng hàm htmlspecialchars là OK.

htmlspecialchars($title_en, ENT_QUOTES)

Thứ Năm, 16 tháng 4, 2026

lấy giá trị form - code php ajax

 <form id="#send-supplier-fast">

<a id="tensanpham" href="'.$link.'" target="_blank" class="link">'.$title.'</a>            

<input type="text" placeholder="Số lượng"  name="soluong" oninput="this.value = this.value.replace(/[^0-9]/g, \'\')" required>

<textarea class="input-textarea" id="content" name="content" required></textarea> 

<button type="submit" id="inquirySend"></button>    

</form>

$(document).on('submit', '#send-supplier-fast', function (e) {

    e.preventDefault();

    const form = $(this);

    const btn  = $('#inquirySend');

    let formData = new FormData();

    // lấy data thường

    formData.append('soluong', $('input[name=soluong]').val());

    formData.append('donvitinh', $('select[name=donvitinh]').val());

    formData.append('content', $('#content').val());

    formData.append('senderMail', $('#senderMail').val());

    formData.append('pid', $('input[name=pid]').val());

    // formData.append('title', $('input[name=title]').val());

    formData.append('title', $('#tensanpham').text().trim());

    formData.append('userid', $('input[name=userid]').val());

    // chỉ append file từ selectedFiles

    selectedFiles.forEach(function(file) {

        if (file && file.size > 0) {

            formData.append('files[]', file);

        }

    });

    btn.prop('disabled', true).text('Đang gửi...');

    $.ajax({

        url: '/send-supplier-product',

        type: 'POST',

        data: formData,

        processData: false,

        contentType: false,

        dataType: 'json',

        success: function (res) {

            // console.log(res);

            if (res && res.status === 'success') {

                showNotify('✅ Gửi yêu cầu thành công!');

                form[0].reset();            

                window.location.href = '/?sendmail=' + res.mail_data.mail_id+ '&token=' + res.mail_data.token;

            } else {

                showNotify('❌ ' + (res.message || 'Có lỗi xảy ra'), 'error');

            }

        },

        error: function () {

            showNotify('❌ Lỗi server', 'error');

        },

        complete: function () {

            btn.prop('disabled', false).text('Gửi yêu cầu');

        }

    });

});

Chỉ cho nhập số vào - code php

 <input type="text" name="khoahoc" class="form-control" oninput="this.value = this.value.replace(/[^0-9]/g, \'\')" required>

Thứ Ba, 14 tháng 4, 2026

SEND EMAIL SMTP - KEIEIJUKU - send supplier

 require_once 'classes/class.phpmailer.php';

require_once 'classes/class.smtp.php';

<!-- take include/data/mail_config.php 

$SuppEmail = email_mail

$mailHost

$mailUsername

$mailPassword

$mailsetFrom 

-->

===== MAIL GỬI CHO SUPPLIER =====

$mail = new PHPMailer();

$mail->CharSet = 'UTF-8';

$mail->isSMTP();


$mail->SMTPKeepAlive = true;

$mail->SMTPDebug = 0;

// $mail->Timeout = 10;

$mail->Host       = $mailHost;

$mail->SMTPAuth   = true;

$mail->Username   = $mailUsername;

$mail->Password   = $mailPassword;

$mail->SMTPSecure = 'ssl';

$mail->Port       = 465;


$mail->setFrom($mailsetFrom, 'KEIEIJUKU KBN');

$mail->addAddress($supplier);

$mail->addReplyTo($customer);

$mail->isHTML(true);

$mail->Subject = $subject;

$mail->Body    = $body;

// ===== MAIL GỬI CHO KHÁCH (NGAY LẬP TỨC) =====

$mail2 = new PHPMailer();

$mail2->CharSet = 'UTF-8';

$mail2->isSMTP();

$mail2->SMTPKeepAlive = true;

$mail2->SMTPDebug = 0;

// $mail2->Timeout = 3;


$mail2->Host       = $mailHost;

$mail2->SMTPAuth   = true;

$mail2->Username   = $mailUsername;

$mail2->Password   = $mailPassword;

$mail2->SMTPSecure = 'ssl';

$mail2->Port       = 465;


$mail2->setFrom($mailsetFrom, 'KEIEIJUKU KBN');

$mail2->addAddress($customer);


$mail2->isHTML(true);

$mail2->Subject = 'Xác nhận đã gửi yêu cầu từ website KEIEIJUKU KBN';

$mail2->Body    = $body;

## Send-Mail

$start = microtime(true);

// gửi mail supplier trước

$ok1 = $mail->send();

$time1 = microtime(true);

// chỉ gửi mail khách nếu mail 1 OK

$ok2 = false;

if($ok1){

    $ok2 = $mail2->send();

}

$time2 = microtime(true);

## ------------------------- ##

// tính thời gian

$time_supplier = round($time1 - $start, 3);

$time_customer = round($time2 - $time1, 3);

$total_time    = round($time2 - $start, 3);

// ghi log

file_put_contents('debug_time.txt',

    "Supplier: {$time_supplier}s\n" .

    "Customer: {$time_customer}s\n" .

    "Total: {$total_time}s\n\n",

    FILE_APPEND

);

Thứ Sáu, 10 tháng 4, 2026

Accept - nhận đuôi file trong upload-file-input

 <input type="file" name="pic_ncc" accept=".jpeg,.jpg,.png">

OR

 <input type="file" name="pic_ncc" accept="image/*">

--> post - action - save

$image_nlh = null;

if (isset($_FILES['pic_ncc']) && $_FILES['pic_ncc']['error'] == 0) {

    $ext = strtolower(pathinfo($_FILES['pic_ncc']['name'], PATHINFO_EXTENSION));

    $allow_ext = array('jpg','png','jpeg');

    if (in_array($ext, $allow_ext)) {

        $new_name = 'picncc_'.time().'.'.$ext;

        if (move_uploaded_file($_FILES['pic_ncc']['tmp_name'], $upload_dir . $new_name)) {

            $image_nlh = $new_name;

        }

    }

}


/**************************/

<input type="file" id="images-file"  accept=".jpeg,.jpg,.png" name="images_file[]" multiple>

--> post - action - save

if (isset($_FILES['images_file']) && !empty($_FILES['images_file']['name'][0])) {

    for ($i = 0; $i < count($_FILES['images_file']['name']); $i++) {

        if ($_FILES['images_file']['error'][$i] == 0) {

            $name = $_FILES['images_file']['name'][$i];

            $tmp  = $_FILES['images_file']['tmp_name'][$i];

            $ext  = strtolower(pathinfo($name, PATHINFO_EXTENSION));

            $allow_ext = array('jpg','png');

            if (!in_array($ext, $allow_ext)) continue;

            $new_name = 'img_' . time() . '_' . $i . '.' . $ext;

            if (move_uploaded_file($tmp, $upload_banner . $new_name)) {

                $images_saved[] = $new_name;

            }

        }

    }

}

$images_db = !empty($images_saved) ? implode('**', $images_saved) : null;