PHP表单处理,数据加载

时间:2018-11-14 02:06:51

标签: php mysql

我的主要目标是在选择产品和付款方式(Criterio de Cobro)时加载价格(单价)。 通过使用查询,我找不到如何放置产品和付款方式变量来查询最终价格。

<label>Producto</label>
<select name="id_producto" class="input_form" id="idCategoriaProducto">
	<option value="" selected="selected">Seleccione...</option>
	<?php
	$q = mysql_query("SELECT id AS idProducto, titulo AS tituloProducto 
                      FROM productos WHERE operando = 1 
                      ORDER BY CAST(SUBSTRING_INDEX(titulo, '.', 1) AS UNSIGNED) ASC, 
                         CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(titulo, '.', -2), '.', 1) AS UNSIGNED) ASC, 
                         CAST(SUBSTRING_INDEX(titulo, '.', -1) AS UNSIGNED) ASC");
	while($r = mysql_fetch_array($q)){
	   extract($r);
	   ?>
	   <option value="<?= $idProducto; ?>" 
           <?php 
           if($id_producto == $idProducto){ 
              echo"selected='selected'";
           } ?>
           ><?= $tituloProducto ?>
	       </option>
	   <?php
	}
	?>
</select>
<label>Criterio de Cobro</label>
	<select name="tipo_cobro" class="input_form" required="required">
	<option value="0" <?php if($tipo_cobro == "0"){echo"selected='selected'";} ?>>Seleccione...</option>
	<option value="1" <?php if($tipo_cobro == "1"){echo"selected='selected'";} ?>>Fijo</option>
	<option value="2" <?php if($tipo_cobro == "2"){echo"selected='selected'";} ?>>Por Hora</option>
	<option value="3" <?php if($tipo_cobro == "3"){echo"selected='selected'";} ?>>Otro</option>
	</select>
	<div class="clear10"></div>
<label>Monto</label>
	<input type="text" name="monto" class="input_form" value="<?= $monto; ?>" >
	<div class="clear10"></div>

0 个答案:

没有答案