
01/04/2011, 10:34
|
| | Fecha de Ingreso: marzo-2011
Mensajes: 24
Antigüedad: 14 años Puntos: 1 | |
como valido option list? Espero y me puedan ayudar necesito que cuando yo valide la caja de texto el option list se quede en el valor que ya estaba elegido, y no me lo reinicie cuando valida la caja de texto si esta vacia. dejo el script para que lo estudien gracias.
============================================= CODIGO=====
<?php
$insertar = $_REQUEST['insertar']; //boton
$dato = $_REQUEST["dato"];
$datos = $_REQUEST['datos'];
//Comprobando datos
if (isset($insertar))
{//iset
//nombre
if (trim($dato) == "")
{
$errores["dato"] = "¡Falta Dato!";
$error = true;
}
else
$errores["dato"] = "";
}
if (isset($insertar) && $error==false)
{
}
else {
?>
<html>
<head>
<title></title>
</head>
<body>
<form method="post" ACTION="eje.php" name="personales">
Dato: <input maxlength="10" size="10" name="dato"<?PHP
if (isset($insertar))
print ("VALUE='$dato'>\n");
else
print (">\n");
if ($errores["dato"] != "")
print ("<BR><SPAN CLASS='error'>" . $errores["dato"] . "</SPAN>");
?>
<select name="datos">
<option>INICIO</option>
<option>dato1</option>
<option>dato2</option>
<option>dato3</option>
<option>dato4</option>
</select>
<br>
<input type="submit" value="Enviar" name="insertar" tabindex="2" >
</form>
</body>
</html>
<?php
}
?> |