我的代码实际上适用于原始html代码附带的第一个输入,但是当我添加一行时,它不计算在内。而且我也想在javascript中显示一个php var。最后,我想使用mysqli将添加的行发布到表中
<div class="card-body">
<h3 align="center">
<?php echo $products; ?>
</h3>
<table align="center">
<thead>
<tr>
<th style="text-align:center;">
<?php echo $code; ?>
</th>
<th style="text-align:center;">
<?php echo $product; ?>
</th>
<th style="text-align:center;">
<?php echo $quantity.' '.$total; ?> <a href="showproducts.php" target="_blank"><i class="fas fa-edit text-danger"></i></a></th>
<th style="text-align:center;">
<?php echo $quantity; ?>
</th>
<th style="text-align:center;">
<?php echo $price.' '.$unit; ?>
</th>
<th style="text-align:center;">
<?php echo $price.' '.$total; ?>
</th>
</tr>
</thead>
<tr>
<td>
<input name="codebar" onchange="codefetch()" type="text" class="form-control form-control-sm"></td>
</td>
<td>
<input type="text" name="product" onchange="autofill()" id="prodname" class="form-control form-control-sm" autocomplete="off" placeholder="<?php echo $prodname; ?>" />
</td>
<td>
<div class=""><input id="quantity" name="quantity" readonly type="text" class="form-control form-control-sm"></td>
<td><input id="neededquantity" name="neededquantity" type="text" class="form-control form-control-sm"></td>
<td><input id="sellprice" name="sellprice" type="text" class="form-control form-control-sm sellprice"></td>
<td><input id="totalprice" name="totalprice" readonly type="text" class="form-control form-control-sm"></td>
</tr>
<tbody id="orderTable">
并且有可能像我打算在我的jscode中那样在javascript中回显php变量
cell2.innerHTML = '<input type="text" name="product" onchange="autofill()" id="prodname" class="form-control form-control-sm" autocomplete="off" placeholder="<?php echo $prodname; ?>" />';
犯罪嫌疑人X