Ver Mensaje Individual
  #1 (permalink)  
Antiguo 19/02/2008, 14:30
coco925
 
Fecha de Ingreso: febrero-2008
Mensajes: 30
Antigüedad: 16 años, 2 meses
Puntos: 0
como puedo validar algunos campos obligatorios

<html>
<!-- Creation date: 10/02/03 -->
<head><title>ingreso1</title></head>
<body>
<div align="center">
<h3>Ingreso cursos Leonardo Frola</h3>
<form name="pide" action="lf_ingmas2.php" method="post" target="_top">
<table bgcolor="yellow" border="2">
<tr><td>Curso<td>
<?
include "conex.php";

$sql = "SELECT id, curso FROM t_cursos_lf ";
$rs = $cnx->query($sql);

echo '<select name="id" style="font: medium;">';
while ($row = $rs->fetchrow())
{
$id = $row[0];
$curson = $row[1];
echo '<option value="'.$id.':'.$curson.'">'.$id.' _ '.$curson.'</option>';
};
echo '</select>' ;
?>

<tr><td>Instructivo<td><input type="text" name="instructivo" size="20" maxlength="12">
<tr bgcolor=yellow><td>CODIGO<td><input type="text" name="codigo" size="40" maxlength="40">
<tr><td>*Fecha (aaaammdd) <td><input type="text" name="fchcurso" size="10" maxlength="10">
<tr bgcolor=lime><td> **¿Curso es Sence? <td><select name="essence">
<option value="no">NO</option>
<option value="si">SI</option>
</select> Si el Codigo es Sence: llene obligatoriamente los campos de color verde<tr>
<tr bgcolor=lime><td>**Codigo Sence <td><input type="text" name="codsence" size="10" maxlength="10"><tr>
<tr><td>*Duracion (Horas)<td><input type="int" name="duracion" size="5" maxlength="3">
<tr><td> *Tipo Relator <td><select name="trelator">
<option value="interno">INTERNO</option>
<option value="externo">EXTERNO</option>
</select>
<tr><td>*Relator<td><input type="text" name="relator" size="40" maxlength="40">
<tr><td>Relator 2<td><input type="text" name="relator2" size="40" maxlength="40">
<tr><td>*Lugar<td><input type="text" name="lugar" size="40" maxlength="40">
<tr><td>Observaciones<td><textarea cols=70 rows=10 name="observaciones"></textarea><br>
<tr bgcolor=lime><td>**Valor Real Hora<td><input type="int" name="vrh" size="10" maxlength="10"><tr>
<tr bgcolor=lime><td>**Organismo<td><input type="text" name="organismo" size="40" maxlength="40"><tr>
<tr bgcolor=33CCFF><td>*Clave de Ingreso<td><input type="password" name="claveingreso" size="10" maxlength="10"><tr>
<tr bgcolor=33CCFF><td>*Cuantos RUT ingresara<td><input type="text" name="total" size="3" maxlength="3"><tr>
<tr><td colspan=2 align=center><input type="Submit" name="pasando" value="continua">
</table>
<H3>* Rellenar Obligatoriamente</H3>
<H3>** Si El Curso es Sence Llene Obligatoriamente</H3>

<?
$rs->free();
$cnx->disconnect();
?>
</form>
<p>
<a href="javascript:history.go(-1)">atras</a>

</div>
</body>
</html>

el punto importante de mi codigo es que si el curso es sence debo llenar obligatoriamente unos campos, si no es sence los valores no son obligatorios (**)

y los demas campos con un asterisco son obligatorios si o si