Ver Mensaje Individual
  #4 (permalink)  
Antiguo 06/02/2009, 10:38
santuariosw
 
Fecha de Ingreso: diciembre-2006
Ubicación: Miami
Mensajes: 55
Antigüedad: 17 años, 4 meses
Puntos: 0
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<form id="form1" name="form1" method="post" action="">
Agregar
<select name="item" id="item">
<option value="5" <?php if (!(strcmp(5, $_POST['item']))) {echo "selected=\"selected\"";} ?>>5</option>
<option value="10" <?php if (!(strcmp(10, $_POST['item']))) {echo "selected=\"selected\"";} ?>>10</option>
<option value="20" <?php if (!(strcmp(20, $_POST['item']))) {echo "selected=\"selected\"";} ?>>20</option>
</select>
Productos
<input type="submit" name="button" id="button" value="Submit" />
</form>

<table width="24%">
<?php $id = 1; $i = 1; while ($i <= $_POST['item'] ){ ?>
<tr>
<td width="35%">Producto <?php echo $id; ?></td>
<td width="32%"><input name="nombre<?php echo $id; ?>" type="text" id="nombre<?php echo $id; ?>" size="10" /></td>
<td width="16%">Precio </td>
<td width="17%"><input name="precio<?php echo $id; ?>" type="text" id="precio<?php echo $id; ?>" size="5" /></td>
</tr>
<?php $i = $i + 1; $id = $id + 1;}?>
</table>

</body>
</html>

Espero te sirva loa cabo de hacer

Última edición por GatorV; 06/02/2009 a las 12:17