Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // sample config
- $servername = "localhost";
- $username = "root";
- $password = "root";
- $dbname = "sample";
- // Create connection
- $conn = new mysqli($servername, $username, $password, $dbname);
- // Check connection
- if ($conn -> connect_error) {
- die("Connection failed: " . $conn -> connect_error);
- }
- if (isset($_POST['submit'])) {
- $price = $_POST['price'];
- $quant = $_POST['quant'];
- $sub = $_POST['sub'];
- foreach ($price as $key => $p) {
- $quantdb = $quant[$key];
- $subdb = $sub[$key];
- $sql = "INSERT INTO table2 (price, quantity, subtotal) VALUES ('$p', '$quantdb', '$subdb')";
- $conn->query($sql);
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement