<?php
session_start();

include "../phpconfig/config.php";
include "../phpconfig/valida_login.php";
include "../includes/topo.php"; 

$id = $_GET['id'];

// $arr = array();
// $sq2l = mysql_query("SELECT * FROM clientes_categorias");
// while (($value = mysql_fetch_array($sq2l))!=false) {
//   $arr[] = $value;
// }


$sql = mysql_query("SELECT * FROM clientes WHERE id='$id'");

$lin = mysql_fetch_assoc($sql);

?>


        <ul class="breadcrumb">
          <li><a href="<?php echo sti('adm');  ?>">Home</a></li>
          <li>Editar cliente 
          <li class="active"><?php echo $lin['nome']; ?> </li>
        </ul>

 <form class="form-horizontal" method="post" action="edita.php"  enctype="multipart/form-data">
              <input type="hidden" name='id'  value='<?php echo $lin['id']; ?>'>
        <fieldset>
        <?php if (strlen($lin['marca']) > 5 && $lin['marca']!="default.jpg"): ?>
          
          <div class="control-group">
            <label class="control-label" for="input01">Marca atual</label>
            <div class="controls">

              <img width='300' src='<?php echo sti('down').$lin['marca'];  ?>' />


               <a class="btn btn-large" title="Deletar imagem" href="delImagem.php?p=<?php echo $id; ?>"><span class="glyphicon glyphicon-remove"></span></a>


            </div>
          </div>

        <?php endif ?>


<!--           <div class="control-group">
            <label class="control-label" for="input01">Categoria</label>
            <div class="controls">
              <select name="categoria">
                <?php foreach ($arr as $value): ?>
                  <option <?php if($lin['id_categoria'] == $value['id']){ echo "selected"; } ?> value="<?php echo $value['id']; ?>"><?php echo $value['titulo']; ?></option>
                <?php endforeach ?>
              </select>
            </div>
          </div> -->


       
          <div class="control-group">
            <label class="control-label" for="input01">Nome</label>
            <div class="controls">
              <input type="text" class="input-xlarge" name='nome' id="input01" value="<?php echo $lin['nome']; ?>">
            </div>
          </div>






<!-- 

          <div class="control-group">        
               <div class="controls">                  
                   <div id="origem">                           
                            <a class="btn btn-warning" id="addR">Serviços prestados</a><br /><br />                            
                   </div>      
                 <div class="esconde">
                   <div class="duplicado">         
                       <input type="text" class="input-xlarge fone" name="servicos[]"/>  
                       <a class="btn btn-warning delR"><i class="icon-remove icon-white"></i></a>   
                   </div>
                 </div>
          
                
                 <div id="destino">  
                  <?php if ($lin['servico_prestado'] != NULL): ?>                   
                      <?php foreach (unserialize($lin['servico_prestado']) as $value): ?>
                          <div class="duplicado">         
                              <input type="text" class="input-xlarge fone" name="servicos[]" value="<?php echo $value; ?>"/>  
                              <a class="btn btn-warning delR"><i class="icon-remove icon-white"></i></a>   
                          </div>
                      <?php endforeach ?>
                  <?php endif ?>
                 </div>  
              </div> 
          </div> -->


   <div class="control-group">
            <label class="control-label" for="input01">Link</label>
            <div class="controls">
              <input type="text" class="input-xxlarge" name='link' id="input01" value="<?php echo $lin['link']; ?>">
            </div>
          </div>




          <div class="control-group">
            <label class="control-label" for="fileInput">Marca (300px X 300px)</label>
            <div class="controls">
              <input class="input-file" id="fileInput" name='imagem' type="file">
            </div>
          </div>


          <div class="form-actions">
            <button type="submit" class="btn btn-primary">Salvar</button>
            <a class="btn btn-warning pull-right" href="index.php">Voltar</a>
          </div>
        </fieldset>
      </form>




<?php include "../includes/rodape.php"; ?>
