你好,谢谢你的到来。
所以我的类别表上有" n"值,并且我的表价格具有" n"重复的idCategorys(外键)。
我想做的是从下拉菜单中选择类别时,HTML表与我选择的类别的所有价格填充。
到目前为止,我设法获得了一个下拉菜单,填充了PHP,如下所示:
<select name="categorias" required id="categorias" >
<?php $render = mysqli_query($con,"SELECT idCategoria FROM neomixlt_desarrollo.Categorias");
while($row1 = mysqli_fetch_array($render)) {
echo "<option value='" . $row1['idCategoria'] . "'>" . $row1['idCategoria'] ."</option>";
}
?>
</select>
和一个填充的表如下
<table width="957" border="2" cellspacing="0">
<tr>
<th width="98" style="text-align: center">Categoria</th>
<th width="99" style="text-align: center">Articulo</th>
<th width="348" style="text-align: center">Precio a Domicilio(bs.)</th>
<th width="348" style="text-align: center">Precio en Planta(bs.)</th>
<th width="40" style="text-align: center"></th>
</tr>
<?php $render = mysqli_query($con,"SELECT * FROM neomixlt_desarrollo.precios_articulo WHERE idCategoria=$link ORDER BY idCategoria DESC ") or die(mysql_error()); ?>
<?php while($row1 = mysqli_fetch_array($render)):; ?>
<tr>
<td style="text-align: center"><?php echo $row1['idCategoria']; ?></td
><td style="text-align: center"><?php echo $row1['idArticulo']; ?></td>
<td style="text-align: center"><?php echo $row1['precio_domi']; ?></td>
<td style="text-align: center"><?php echo $row1['precio_plant']; ?></td>
<td style="text-align: center"><?php echo "<a href=editar_precios.php?pid=$row1[idArticulo]&cid=$row1[idCategoria]&precio_domi=$row1[precio_domi]&precio_plant=$row1[precio_plant]>editar</a>" ?></td>
</tr>
<?php endwhile; ?>
</table>
,但它们没有链接,我对如何执行此操作没有太多想法。IM仅限于使用PHP和HTML,我发现的所有类似示例都使用JavaScript或Ajax,有什么想法吗?预先感谢!
w/o javaScript,jQuery,Angular等。可用,您需要每次提交。因此,将页面加载到其原始状态,用户将选择其类别。现在,没有可用于运行更新的可为您运行的更新,您需要将表单提交给服务器,然后在服务器端,获取POST类别,并构建所需的HTML并将其发送给浏览器看法。每次更改类别时,都必须完成此操作。