I'm having the following problem, I have a sales registration system, and in those sales I can add a product for each order, but how would I add multiple products for 1 order?
Sales registration code:
<?php
ini_set('default_charset','UTF-8');
if(isset($_POST['send'])){
$venda = $_POST['num_venda'];
$data = $_POST['data_venda'];
$placa = $_POST['placa'];
$km = $_POST['km'];
$produtos = $_POST['produtos'];
$servicos = $_POST['servicos'];
include ('banco.php');
mysql_query("INSERT INTO venda(id_venda, num_venda, data_venda, placa, km, produtos, servicos)
values(
NULL,
'{$venda}',
'{$data}',
'{$placa}',
'{$km}',
'{$produtos}',
'{$servicos}'
)
");
mysql_query("INSERT INTO vendaproduto (id_venda, produtos) SELECT venda.id_venda, venda.produtos FROM venda ORDER BY venda.id_venda DESC LIMIT 1")or die(mysql_error());
mysql_query("INSERT INTO vendaservico (id_venda, servicos) SELECT venda.id_venda, venda.servicos FROM venda ORDER BY venda.id_venda DESC LIMIT 1")or die(mysql_error());
}
header("location:lista.php");
?>
I have 3 tables, sale , products , sell products , I get the information from the first 2 tables and I enter the table sell products that would look like this: