<!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=iso-8859-1" />
  <title>UCA :.</title>
  <link href="ucaestilos.css" rel="stylesheet" type="text/css" />
  <script>
    function limpia1() {
      document.form1.contra1.value = "";
    }

    function limpia2() {
      document.form1.contra2.value = "";
    }
  </script>
</head>

<body>
  <table width="750" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
      <td>
        <form action="editusuario2.php" method="post" name="form1" id="form1">
          <table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
              <td>
                <p class="style4">Editar Usuario:</p>
                <hr align="left" width="600" size="1" color="#999999" />
                <div align="center">
                  <div align="center">
                    <?php if (isset($_GET['error']))
                      $error = $_GET['error']; {

                      if (isset($error)) {
                        $error = $_GET['error'];

                        if ($error == 1) {
                          echo "<p class='style9'>Los campos de contrase&ntilde;a no coinciden</p>";
                        }
                        if ($error == 2) {
                          echo "<p class='style9'>&iexcl;El nombre de usuario ya existe!</p>";
                        }
                      } else {
                      }
                    }
                    ?>
                  </div>
                  <?php include('conexion.php');
                  $usua = $_GET['usua'];

                  $cons = "SELECT * from usuarios WHERE idUsuario='$usua'";
                  $res = mysql_query($cons, $conex) or die("No se realizo la busqueda de usuario");
                  $nom = mysql_result($res, 0, 'nombre');
                  $correo = mysql_result($res, 0, 'correo');
                  $contra = mysql_result($res, 0, 'password');
                  $tipo = mysql_result($res, 0, 'tipo');
                  ?>
                </div>
                <table width="431" border="0" align="center" cellspacing="5">
                  <tr>
                    <td width="178" class="style1">
                      <p class="style4">Nombre de usuario:</p>
                    </td>
                    <td width="234"><input name="nombre" type="text" class="cuadrotexto" id="nombre" value="<?php echo $nom; ?>" size="15" maxlength="15" /></td>
                  </tr>
                  <tr>
                    <td width="178" class="style1">
                      <p class="style4">ID Usuario:</p>
                    </td>
                    <td width="234"><input name="id" type="text" class="cuadrotexto" id="id" value="<?php echo $usua; ?>" size="15" maxlength="15" readonly="readonly"></td>
                  </tr>
                  <tr>
                    <td width="178" class="style1">
                      <p class="style4">Contraseña:</p>
                    </td>
                    <td width="234"><input name="contra1" type="password" class="cuadrotexto" id="contra1" value="******" size="15" maxlength="15" onclick="javascript:limpia1()"></td>
                  </tr>
                  <tr>
                    <td width="178" class="style1">
                      <p class="style4">*Verificar contraseña:</p>
                    </td>
                    <td width="234"><input name="contra2" type="password" class="cuadrotexto" id="contra2" value="******" size="15" maxlength="15" onclick="javascript:limpia2()"></td>
                  </tr>
                  <tr>
                    <td width="178" class="style1">
                      <p class="style4">Tipo de usuario:</p>
                    </td>
                    <td width="234">


                      <select name='tipo' class='cuadrotexto' id='tipo'>

                        <option value='superadministrador' <?php if ($tipo == 'superadministrador') { ?> selected='selected' <?php } ?>>Super Administrador</option>


                        <option value='administrador' <?php
                                                      if ($tipo == 'administrador') { ?> selected='selected' <?php } ?>>Administrador</option>



                        <option value='farmacia' <?php if ($tipo == 'farmacia') { ?> selected='selected' <?php } ?>>Farmacia</option>

                        <option value='caja' <?php if ($tipo == 'caja') { ?> selected='selected' <?php } ?>>Caja</option>

                        <option value='coordinador' <?php if ($tipo == 'coordinador') { ?> selected='selected' <?php } ?>>Coordinador</option>
                      </select>
                      <?php
                      /*
					if ($tipo =='administrador')
					{
						echo "<select name='tipo' class='cuadrotexto' id='tipo'>";
                      	echo "<option value='administrador' selected='selected'>Administrador</option>";
                      	echo "<option value='farmacia'>Farmacia</option>";
                        echo "<option value='caja'>Caja</option>";
                        echo "<option value='recepcion'>Recepcion</option>";
                        echo "<option value='academico'>Acad&eacute;mico</option>";
                      	echo "</select>";
					 }
					 if ($tipo =='farmacia')
					{
						echo "<select name='tipo' class='cuadrotexto' id='tipo'>";
                      	echo "<option value='administrador'>Administrador</option>";
                      	echo "<option value='farmacia' selected='selected'>Farmacia</option>";
                        echo "<option value='caja'>Caja</option>";
                        echo "<option value='recepcion'>Recepcion</option>";
                        echo "<option value='academico'>Acad&eacute;mico</option>";
                      	echo "</select>";
					 }
					 if ($tipo =='caja')
					{
						echo "<select name='tipo' class='cuadrotexto' id='tipo'>";
                      	echo "<option value='administrador'>Administrador</option>";
                      	echo "<option value='farmacia'>Farmacia</option>";
                        echo "<option value='caja' selected='selected'>Caja</option>";
                        echo "<option value='recepcion'>Recepcion</option>";
                        echo "<option value='academico'>Acad&eacute;mico</option>";
                      	echo "</select>";
					 }
					 if ($tipo =='recepcion')
					{
						echo "<select name='tipo' class='cuadrotexto' id='tipo'>";
                      	echo "<option value='administrador'>Administrador</option>";
                      	echo "<option value='farmacia'>Farmacia</option>";
                        echo "<option value='caja'>Caja</option>";
                        echo "<option value='recepcion' selected='selected'>Recepcion</option>";
                        echo "<option value='academico'>Acad&eacute;mico</option>";
                      	echo "</select>";
					 }
					 if ($tipo =='academico')
					{
						echo "<select name='tipo' class='cuadrotexto' id='tipo'>";
                      	echo "<option value='administrador'>Administrador</option>";
                      	echo "<option value='farmacia'>Farmacia</option>";
                        echo "<option value='caja'>Caja</option>";
                        echo "<option value='recepcion'>Recepcion</option>";
                        echo "<option value='academico' selected='selected'>Acad&eacute;mico</option>";
                      	echo "</select>";
					 }
					 
				 
						echo "<select name='tipo' class='cuadrotexto' id='tipo'>";
                      	echo "<option value='administrador'>Administrador</option>";
                      	echo "<option value='farmacia'>Farmacia</option>";
                        echo "<option value='caja'>Caja</option>";
                        echo "<option value='recepcion'>Recepcion</option>";
                        echo "<option value='academico' selected='selected'>Acad&eacute;mico</option>";
                      	echo "</select>";
				 
					 */
                      ?>
                    </td>
                  </tr>
                  <tr>
                    <td width="178" class="style1">
                      <p class="style4">Cl�nica:</p>
                    </td>
                    <td width="234"><?php

                                    include("conexion.php");
                                    $cons = "SELECT * FROM clinicas";
                                    $res = mysql_query($cons, $conex) or die("No se pudo consultar las clinicas");
                                    echo "<select name='clinica' class='cuadrotexto'>";
                                    while ($campo = mysql_fetch_assoc($res)) {
                                      echo "<option value=" . $campo['idClinica'] . " >" . $campo['clinica'] . "</option>";
                                    }
                                    echo "</select>";

                                    ?></td>
                  </tr>
                  <tr>
                    <td class="style4">Correo:</td>
                    <td><input name="correo" type="text" class="cuadrotexto" id="correo" value="<?php echo $correo; ?>" size="30" maxlength="40" /></td>
                  </tr>
                </table>
                <p class="style4"></p>
                <table width="146" border="0" align="center" cellspacing="10">
                  <tr>
                    <td width="58">
                      <div align="right">
                        <input name="Reset" type="reset" class="boton2" onclick="javascript:history.back()" value="Cancelar" />
                      </div>
                    </td>
                    <td width="75"><input name="Submit2" type="submit" class="boton2" value="Guardar" /></td>
                  </tr>
                </table>
                <p></p>
              </td>
            </tr>
          </table>
        </form>
      </td>
    </tr>
  </table>
</body>

</html>