<form id="<?php echo $table;?>" style="display:inline-block">
<input type="text" name="nazenkaTon" style="width: 30px" value="">
<input type="hidden" name="tabl" value="<?php echo $table;?>">
<input id = "submit" type = "submit" value="записать наценку тонны">
</form>
</div>
<script>
$("#????????").submit(function (e) {
e.preventDefault();
var form_data = $(this).serialize();
$.ajax({
type: "POST",
url: "change.php",
data: form_data,
success: function () {
alert("отправлено!");
}
});
});
</script
<?php
$cnt = db::getConnect();
$res = $cnt->prepare("SELECT DISTINCT TABLE_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_NAME LIKE 'marza'");
$res->execute();
$i = 0;
while ($res_table = $res->fetch()):
$table = $res_table['TABLE_NAME'];
$kategory_name = names::getTable($table);?>
<div style="text-align: center;">
<h2 style="display:inline-block;margin-right: 50px"><?php echo $kategory_name;?></h2>
<form id="form1" style="display:inline-block">
<input type="text" name="nazenkaTon" style="width: 30px" value="">
<input type="hidden" name="tabl" value="<?php echo $table;?>">
<input id = "submit" type = "submit" value="записать наценку тонны">
</form>
</div>
<?php
$result = $cnt->prepare("SELECT name, size, steel, price_metr, price_ot_1tonn, ed_izm_shote, marza, marza_ton, id_product FROM $table");
$result->execute();
$i = 0;
while ($row = $result->fetch()) {
$prodact[$i]['id_product'] = $row['id_product'];
$prodact[$i]['name'] = $row['name'];
$prodact[$i]['size'] = $row['size'];
$prodact[$i]['steel'] = $row['steel'];
$prodact[$i]['price_metr'] = $row['price_metr'];
$prodact[$i]['ed_izm_shote'] = $row['ed_izm_shote'];
$prodact[$i]['price'] = $row['price_ot_1tonn'];
$prodact[$i]['marza'] = $row['marza'];
$prodact[$i]['marza_ton'] = $row['marza_ton'];
$price = $prodact[$i]['price'];
$marza = 1 + $prodact[$i]['marza']/100;
$marza_ton = 1 + $prodact[$i]['marza_ton']/100;
$allmet_ton = round(($price*$marza_ton), -1);
$allmet_metr = round(($prodact[$i]['price_metr']*$marza), 2);
?>
<div>
<p class="inline" style="width: 200px;text-align: left;"><?php echo $prodact[$i]['name'];?></p>
<p class="inline" style="width: 100px"><?php echo $prodact[$i]['size'];?></p>
<p class="inline" style="width: 80px"><?php echo $prodact[$i]['steel'];?></p>
<p class="inline" style="width: 30px"><?php echo $prodact[$i]['ed_izm_shote'];?></p>
<form id="form3" style="display: inline-table;width:50%">
<input type="hidden" name="table" value="<?php echo $table;?>">
<input type="hidden" name="idproduct" value="<?php echo $prodact[$i]['id_product'];?>">
<input style="width: 50px;color: red" type="text" name="price" value="<?php echo $price;?>">
<input style="width: 50px;color: blue" type="text" name="priceallmet" value="<?php echo $allmet_ton;?>">
<p class="inline" style="width:60px;"><?php echo ($marza_ton-1)*100;?>%</p>
<input style="width: 50px;color: red" type="text" id="pricemetr" name="pricemetr" value="<?php echo $prodact[$i]['price_metr'];?>">
<input style="width: 50px;color: blue;" type="text" name="allmetmetr" value="<?php echo $allmet_metr;?>">
<p class="inline" style="width:70px;"><?php echo ($marza-1)*100;?>%</p>
</form></div>
<?php
$i++;}
$i++;
endwhile;?>
<script>
$("#form1").submit(function (e) {
e.preventDefault();
var form_data = $(this).serialize();
$.ajax({
type: "POST",
url: "change.php",
data: form_data,
success: function () {
alert("отправлено!");
}
});
});
</script>
<form id="form1" style="display:inline-block">
<input type="text" name="nazenkaTon" style="width: 30px" value="">
<input type="hidden" name="table" value="<?php echo $table;?>">
<input id = "submit" type = "submit" value="записать ">
</form>
<script>
$("#form1").submit(function (e) {
e.preventDefault();
var form_data = $(this).serialize();
$.ajax({
type: "POST",
url: "change.php",
data: form_data,
success: function () {
alert("отправлено!");
}
});
});
</script>