Это мой код для мобильного приложения jquery. Но форма i, созданная с результатом php
не работает. Форма не публикует данные для отправки. Я даже попробовал data-ajax="flase"
.
<table id="stock"> <? $sql = mysqli_query($con, "SELECT * FROM products WHERE `product_id` = '1'"); while($row=mysqli_fetch_array($sql)){ $name = $row['name']; $chamecal = $row['chamecal']; $price = $row['selling_price']; $bprice = $row['buying_price']; $quantity = $row['quantity']; $manufacturer = $row['manufacturer']; $date = $row['date']; $edate = $row['expire']; $pid = $row['product_id']; ?> <form id="stockupdate" method="post" action="medupdate.php"> <tr> <td><?=$name;?></td> <td><?=$chamecal;?></td> <td><?=$manufacturer;?></td> <td><input type="text" name="medbprice" value="<?=$bprice;?>" /></td> <td><input type="text" name="medprice" value="<?=$price;?>" /></td> <td><?=$date;?></td> <td><?=$edate;?></td> <td><input type="text" name="medstock" value="<?=$quantity;?>" /></td> <td class="ui-screen-hidden"><input type="text" name="pid" value="<?=$pid;?>" /></td> <td> <input type="submit" title="Update" data-icon="gear" data-theme="f" data-inline="true" data-iconpos="notext" /> </td> </tr> <? } ?> </form> </table>
в<table id="stock"> <? $sql = mysqli_query($con, "SELECT * FROM products WHERE `product_id` = '1'"); while($row=mysqli_fetch_array($sql)){ $name = $row['name']; $chamecal = $row['chamecal']; $price = $row['selling_price']; $bprice = $row['buying_price']; $quantity = $row['quantity']; $manufacturer = $row['manufacturer']; $date = $row['date']; $edate = $row['expire']; $pid = $row['product_id']; ?> <form id="stockupdate" method="post" action="medupdate.php"> <tr> <td><?=$name;?></td> <td><?=$chamecal;?></td> <td><?=$manufacturer;?></td> <td><input type="text" name="medbprice" value="<?=$bprice;?>" /></td> <td><input type="text" name="medprice" value="<?=$price;?>" /></td> <td><?=$date;?></td> <td><?=$edate;?></td> <td><input type="text" name="medstock" value="<?=$quantity;?>" /></td> <td class="ui-screen-hidden"><input type="text" name="pid" value="<?=$pid;?>" /></td> <td> <input type="submit" title="Update" data-icon="gear" data-theme="f" data-inline="true" data-iconpos="notext" /> </td> </tr> <? } ?> </form> </table>
Файл обработчика значений medupdate.php
<?php session_start();?> <?php include_once('include/config.php');?> <? $pid = $_POST['pid']; $medbprice = $_POST['medbprice']; $medprice = $_POST['medprice']; $medstock = $_POST['medstock']; $sql = mysqli_query($con, "UPDATE `products` SET `quantity` = '$medstock', `buying_price` = '$medbprice' , `selling_price` = '$medprice' WHERE `product_id` = '$pid'"); if($sql){ echo 1; } ?>