fordev22.com
  • Home
  • สอนทำระบบ POS (Point of Sale)
  • Flutter สำหรับผู้เริ่มต้น
  • PHP+MySqli
  • เนื้อหาอื่น ๆ
    • สอน Bootstrap 5
    • Dreamweaver+Bootstrap+PHP
    • Dreamweaver
    • Computer Tip
  • ABOUT US
    • Personal information
    • บริการ
    • ผลงาน
    • ตัวอย่าง ผลงานด้านการสอน (สอนสดผ่าน Google Meet, Zoom)
  • Search

PHP+MySqli EP.38 Ajax multipart insert

June 30, 2022/in PHP+MySqli /by fordev22

PHP+MySqli EP.38 Code Ajax multipart insert

 

 

 


ระบบ ตระกร้าสินค้า แบบไม่สมัครสมาชิกสั่งซื้อได้

 

ระบบ ตระกร้าสินค้าแบบสมัครสมาชิก

ระบบ ตระกร้าสินค้า ADVANCE แจ้งเตือนชำระเงินผ่านไลน์

ระบบ เช่าชุดออนไลน์

ระบบ บริหารจัดการห้องพัก

Code หน้า aj_f.php

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<!doctype html>
<html lang="en">
  <head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
 
    <!-- Bootstrap CSS -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
     <link href=" https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
 
  
 
    <title>Hello, world!</title>
  </head>
  <body>
    <h1></h1>
 
 
 
    <script language="javascript">
function CreateNewRow()
{
var intLine = parseInt(document.frmMain.hdnMaxLine.value);
intLine++;
var theTable = document.all.tbExp
var newRow = theTable.insertRow(theTable.rows.length)
newRow.id = newRow.uniqueID
var item1 = 1
var newCell
//*** Column 1 ***//
newCell = newRow.insertCell(0)
newCell.id = newCell.uniqueID
newCell.setAttribute("className", "css-name");
// newCell.innerHTML = "<center><INPUT TYPE=\"TEXT\" SIZE=\"5\" NAME=\"Column1_"+intLine+"\" VALUE=\"\"></center>"
newCell.innerHTML = "<center><INPUT TYPE=\"TEXT\" CLASS=\"form-control\" SIZE=\"5\" NAME=\"Column1["+intLine+"]\" VALUE=\"\"></center>"
 
document.frmMain.hdnMaxLine.value = intLine;
}
function RemoveRow()
{
intLine = parseInt(document.frmMain.hdnMaxLine.value);
if(parseInt(intLine) > 0)
{
theTable = (document.all) ? document.all.tbExp :
document.getElementById("tbExp")
theTableBody = theTable.tBodies[0];
theTableBody.deleteRow(intLine);
intLine--;
document.frmMain.hdnMaxLine.value = intLine;
}
}
</script>
<body>
 
<div class="container">
<div class="row">
<div class="col-md-3">
</div>
<div class="col-md-6">
<br>
<br>
<center><img src="logo_fordev22_2.png" width="60%" alt=""></center>
<br>
<form name="frmMain" method="post" action="aj_s.php">
<table class="table table-striped" width="445" border="1" id="tbExp">
 
  <tr>
    <td><div align="center"><h3>Ajax multipart insert By fordev22</h3></div></td>
    
  </tr>
</table>
<center>
 
<input type="hidden"  name="hdnMaxLine" value="0">
<div class="btn-group" role="group" aria-label="Basic mixed styles example">
<input name="btnAdd" class="btn btn-primary btn-md" type="button" id="btnAdd" value="Add" onClick="CreateNewRow();">
<input name="btnDel" type="button" class="btn btn-danger btn-md" id="btnDel" value="Del" onClick="RemoveRow();">
<button type="submit" class="btn btn-secondary btn-md">Save</button>
</div>
</center>
 
</form>
</div>
<div class="col-md-3">
</div>
</div>
</div>
    <!-- Optional JavaScript; choose one of the two! -->
 
    <!-- Option 1: Bootstrap Bundle with Popper -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
 
    <!-- Option 2: Separate Popper and Bootstrap JS -->
    <!--
    <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.2/dist/umd/popper.min.js" integrity="sha384-IQsoLXl5PILFhosVNubq5LC7Qb9DXgDA9i+tQ8Zj3iwWAwPtgFTxbJ8NT4GN1R8p" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.min.js" integrity="sha384-cVKIPhGWiC2Al4u+LWgxfKTRIcfu0JTxR+EQDz/bgldoEyl4H0zUF0QKbrJ0EcQF" crossorigin="anonymous"></script>
    -->
  </body>
 
</html>

Code หน้า aj_s.php

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php
echo "<pre>";
print_r($_POST);
echo "</pre>";
// foreach($_POST['Column1'] as $key => $value){
// // print_r($key);
// echo $_POST['Column1'][$key].'<br>';
 
// }
exit();
include('condb.php');
 
foreach($_POST['Column1'] as $key => $value){
$sql4 = sprintf("INSERT INTO t_aj (column1,column2,column3,column4,column5) VALUES ('%s','%s','%s','%s','%s')",
$_POST['Column1'][$key],
$_POST['Column2'][$key],
$_POST['Column3'][$key],
$_POST['Column4'][$key],
$_POST['Column5'][$key]
);
$query4 = mysqli_query($con, $sql4) or die ("Error in query: $sql4 " . mysqli_error());
}
 
?>

con_db.php

1
2
3
4
5
6
<?php
$con= mysqli_connect("localhost","root","","ชื่อDatabase") or die("Error: " . mysqli_error($con));
mysqli_query($con, "SET NAMES 'utf8' ");
error_reporting( error_reporting() & ~E_NOTICE );
date_default_timezone_set('Asia/Bangkok');
?>

sql

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
-- phpMyAdmin SQL Dump
-- version --
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Jun 30, 2022 at 11:10 AM
-- Server version: 10.4.14-MariaDB
-- PHP Version: 7.4.11
 
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
 
 
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
 
--
-- Database: `food_db`
--
 
-- --------------------------------------------------------
 
--
-- Table structure for table `t_aj`
--
 
CREATE TABLE `t_aj` (
  `pk` int(11) NOT NULL,
  `Column1` text DEFAULT NULL,
  `Column2` text DEFAULT NULL,
  `Column3` text DEFAULT NULL,
  `Column4` text DEFAULT NULL,
  `Column5` text DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
--
-- Dumping data for table `t_aj`
--
 
INSERT INTO `t_aj` (`pk`, `Column1`, `Column2`, `Column3`, `Column4`, `Column5`) VALUES
(3, 'fordev22', '', '', '', ''),
(4, 'fordev22', '', '', '', ''),
(5, 'fordev22', '', '', '', '');
 
--
-- Indexes for dumped tables
--
 
--
-- Indexes for table `t_aj`
--
ALTER TABLE `t_aj`
  ADD PRIMARY KEY (`pk`);
 
--
-- AUTO_INCREMENT for dumped tables
--
 
--
-- AUTO_INCREMENT for table `t_aj`
--
ALTER TABLE `t_aj`
  MODIFY `pk` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
COMMIT;
 
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

 

Facebook
Twitter
Line
Tags: Ajax multipart insert, Bootstrap, Database, Databases Multiple Connect, Multiple MySqli Databases, MySqli Databases, php, php+sqli, Selecting and Using Multiple MySqli Databases, Selecting Database, สอนทำเว็บ, สอนเขียนเว็บ Share this entry
Share this entry
  • Share on Facebook
  • Share on Twitter
  • Share on Google+
  • Share on Pinterest
  • Share on Linkedin
  • Share on Tumblr
  • Share on Vk
  • Share on Reddit
  • Share by Mail
https://fordev22.com/wp-content/uploads/2022/06/1656580459985.jpg 706 1474 fordev22 https://fordev22.com/wp-content/uploads/2018/08/logo_fordev22_2.png fordev222022-06-30 16:23:412022-07-01 14:06:59PHP+MySqli EP.38 Ajax multipart insert
You might also like
สอนทำระบบ POS (ระบบขายหน้าร้าน) Ep 20. ฟอร์มแก้ไขข้อมูลสินค้า (จัดการสินค้า Part 4)
Bootstrap EP.7 การ include file ในการทำเว็บในแต่ละหน้า
สอนทำระบบ POS (ระบบขายหน้าร้าน) Ep 30. วนลูปสินค้าที่เลือกเพื่อเตรียมบันทึกลง Order detail (บันทึกการสั่งซื้อ Part 2)
สอนทำระบบ POS (ระบบขายหน้าร้าน) Ep 41. การนำ QR-Code มาใช้งาน
แจก Modal Example By fordev22
Bootstrap EP.13 การเพิ่มข้อมูลรูปภาพภาพอื่น ๆ ที่เกี่ยวข้องโดยใช้ Database 2 ตารางร่วมกันและลบข้อมูลที่เกี่ยวข้อง 2 ตารางร่วมกันแบบเขียนโค๊ด
PHP+MySqli EP.6 Login Logout แบบแยกสิทธ์การใช้งาน
PHP+MySqli EP.38 PHP Selecting and Using Multiple MySqli Database

บริการและผลงาน

  • Home
  • Personal Information
  • คอสเรียนที่เปิดอยู่
  • ตัวอย่าง ผลงานด้านการสอน (สอนสดผ่าน Google Meet, Zoom)
  • บริการ
  • ผลงาน

ช่องทางการติดต่อ

Tel. 090-959-1107

ID Line. fordza4you

E-mail. fordza4you@gmail.com


รับพัฒนาระบบ
รับพัฒนาเว็บแอพพลิเคชั่น
รับพัฒนาเว็บไซต์

Page

Popular
  • สอน Flutter Ep 4. ติดตั้ง SDK Simulator...June 7, 2023 - 1:54 pm
  • Computer Tip EP.2 การปรับเสียง...October 13, 2016 - 10:13 pm
  • Dreamweaver EP.1 ลงโปรแกรมจำลอง...October 15, 2016 - 9:28 pm
  • Dreamweaver EP.2 สร้าง Database ด้วย ...October 16, 2016 - 12:48 pm
  • Dreamweaver EP.3 การสร้างที่เก็บเว็บไซต์และสร้าง...October 16, 2016 - 6:33 pm
Recent
  • สอน Flutter Ep 4. ติดตั้ง SDK Simulator...June 7, 2023 - 1:54 pm
  • สอน Flutter Ep 3. ติดตั้ง Xcode เพื่อใช้...June 7, 2023 - 1:49 pm
  • สอน Flutter Ep 2. วิธีติดตั้ง...June 7, 2023 - 1:16 pm
  • สอน Flutter Ep 1. วิธีติดตั้ง...June 7, 2023 - 10:52 am
  • (2023) PHP+MySqli EP.43 How to AJAX CrudPHP MySqli (Part...April 21, 2023 - 6:15 pm
Comments
  • sssssMay 4, 2017 - 11:52 am by fordev22
  • sssssMay 4, 2017 - 11:50 am by fordev22
  • Awaiting BACS payment Order status changed from Pending...March 1, 2017 - 9:23 am by WooCommerce
Tags
Bootstrap Database Datatable Datatable Serverside Dreamweaver Edit Sqli Mysqli php php+sqli php+sqli php+sqli Point of Sale Point of SalePOS POS POS System POS System showe Sqli sqli xampp กับ dreamweaver ฟรีโปรเจคนักศึกษา ฟอร์ม php รับพัฒนาระบบ รับพัฒนาระบบ รับเขียนโปรแกรม รับเขียนโปรแกรม ลบข้อมูล สร้าง Database สอน bootstrap สอน php สอน php mysql สอน php mysqli สอน php พื้นฐาน สอน php เบื้องต้น สอนทำเว็บ สอนทำเว็บ สอนทำเว็บ สอนพัฒนาระบบ สอนพัฒนาระบบ สอนเขียนเว็บ สอนเขียนเว็บ สอนเขียนเว็บ สอนเขียนโปรแกรม สอนเขียนโปรแกรม เขียนโปรแกรมราคาถูก เขียนโปรแกรมราคาถูก เพิ่มข้อมูล เพิ่มรูป แจกระบบ php แจกโคด php โปรเจคคอมธุ โปรเจคคอมพิวเตอร์ โปรเจคคอมพิวเตอร์ธุรกิจ โปรเจคจบ คอมพิวเตอร์ โปรเจคนักศึกษา โปรเจควิทยาการคอม โปรเจควิทยาการคอม Share this entry

Copyright@2018.fordev22.com

สอนทำระบบ POS (ระบบขายหน้าร้าน)... สอนทำระบบ POS (ระบบขายหน้าร้าน)...
Scroll to top