Hola Foro, Buenas tardes...
Estoy programando un documento php el cual tiene un Input <select
El tema es ke la lista es fija y yo nesecito agregar nuevos conseptos, como puedo agregar un nuevo value al input con php????
Les agrego el codigo que uso....
Código PHP:
<form action="MovimientoCajaOprs.php" method="Post">
<fieldset class="Estilo4">
<p>
<legend class="style1">Ingresar Movimiento </legend>
</p>
<label for="Consepto">Consepto</label> <br/>
<select id="LstConsep" name="LstConsepto" >
<option value="- selecciona -" selected="selected">- selecciona -</option>
<?php
mssql_connect ($_SESSION[dbhost], $_SESSION[dbusername], $_SESSION[dbuserpass]);
mssql_select_db($_SESSION[dbname]) or die('Cannot select database');
$resultLst = mssql_query ("SELECT distinct Consepto as Lista FROM CajaOp WHERE Consepto <> 'Inicio de Caja'");
// $i = 0;
while ($row = mssql_fetch_array($resultLst)) {
echo "<option value='".$row['Lista']."'>".$row['Lista']."</option>";
// $i++;
};
?>
</select>
<br/>
<span class="Estilo4">Sub Consepto</span> <br/>
<input type="text" name="SubConsepto" value="Ingrese Sub Consepto" size="60" />
<br/>
<label for="Consepto">Operacion</label> <br/>
<select id="Operacion" name="Operacion">
<option value="" selected="selected">- selecciona -</option>
<option value="Ingreso">Ingreso</option>
<option value="Egreso">Egreso</option>
</select>
<span class="Estilo4">Importe:</span>
<input type="text" name="Importe" value="0.0" size="6" maxlength="9"/>$
<br/>
</fieldset>
<input type="submit" border="0" value="Aceptar">
</form>
</div>
<div id="Layer21">
<a href="MovimientoCajaOprs.php?action=ModConsepto&id='1'"><Agregar</a></div>
<div id="Layer19">
<form id="IngrLiq" action="CajaOprs.php" onsubmit="return enviar();">
<input type="submit" onclick="CajaOprs.php" name="Submit2" value="Cancelar" />
</div>
<div id="Layer20">
<?PHP
$Consepto = $_REQUEST['Consepto'];
$SubConsepto = $_REQUEST['SubConsepto'];
$Operacion = $_REQUEST['Operacion'];
$Importe = $_REQUEST['Importe'];
if ($Consepto == "- selecciona -"){
Echo "<span class='Estilo1'>Error Campo: (Consepto) Esta Vacio¡¡¡</span><br/>";
exit;
};
if ($SubConsepto == "Ingrese Sub Consepto"){
Echo "<span class='Estilo1'>Error Campo: (SubConsepto) Esta Vacio¡¡¡</span><br/>";
exit;
};
if ($Operacion == "- selecciona -"){
Echo "<span class='Estilo1'>Error Campo: (Operacion) Esta Vacio¡¡¡</span><br/>";
exit;
};
if ($Importe == "0.0"){
Echo "<span class='Estilo1'>Error Campo: (Importe) Esta Vacio¡¡¡</span><br/>";
exit;
};
?>
</div>
<?PHP
if($_REQUEST['action']=="ModConsepto")
{
echo "<select id='LstConsep' name='LstConsepto' >";
//echo "<option value="- selecciona -" selected="selected">- selecciona -</option>"
echo "<option value='1111'>11111</option>";
// echo "<select id='LstConsep' name='LstConsepto' disabled='disabled'>";
echo "</select>";
};
?>
Espero me puedan ayudar¡¡¡¡¡
Saludos a todos¡¡¡
Gracias¡¡¡