Pesquisar na Comunidade
Mostrando resultados para as tags ''pronta''.
Encontrado 1 registro
-
Fala galera, Fiz essa função básica para gerar estados generica, serve tanto para inserir no banco, como recuperar o estado inserido, segue abaixo o codigo. Bons codigos. function estados($id=NULL){ $html = "<select name='txtEstado' class='form-control' required>" . "<option value=''>SELECIONE O ESTADO</option>"; if($id == "AC") $html.= "<option selected value='AC'>ACRE</option>"; else $html.="<option value='AC'>ACRE</option>"; if($id == "AL") $html.= "<option selected value='AL'>ALAGOAS</option>"; else $html.="<option value='AL'>ALAGOAS</option>"; if($id == "AM") $html.= "<option selected value='AM'>AMAZONAS</option>"; else $html.="<option value='AM'>AMAZONAS</option>"; if($id == "AP") $html.= "<option selected value='AP'>AMAPA</option>"; else $html.="<option value='AC'>ACRE</option>"; if($id == "BA") $html.= "<option selected value='BA'>BAHIA</option>"; else $html.="<option value='BA'>BAHIA</option>"; if($id == "CE") $html.= "<option selected value='CE'>CEARA</option>"; else $html.="<option value='CE'>CEARA</option>"; if($id == "DF") $html.= "<option selected value='DF'>DISTRITO FEDERAL</option>"; else $html.="<option value='DF'>DISTRITO FEDERAL</option>"; if($id == "ES") $html.= "<option selected value='ES'>ESPIRITO SANTO</option>"; else $html.="<option value='ES'>ESPIRITO SANTO</option>"; if($id == "GO") $html.= "<option selected value='GO'>GOIAS</option>"; else $html.="<option value='GO'>GOIAS</option>"; if($id == "MA") $html.= "<option selected value='MA'>MARANHAO</option>"; else $html.="<option value='MA'>MARANHAO</option>"; if($id == "MT") $html.= "<option selected value='MT'>MATO GROSSO</option>"; else $html.="<option value='MT'>MATO GROSSO</option>"; if($id == "MS") $html.= "<option selected value='MS'>MATO GROSSO DO SUL</option>"; else $html.="<option value='MS'>MATO GROSSO DO SUL</option>"; if($id == "MG") $html.= "<option selected value='MG'>MINAS GERAIS</option>"; else $html.="<option value='MG'>MINAS GERAIS</option>"; if($id == "PA") $html.= "<option selected value='PA'>PARA</option>"; else $html.="<option value='PA'>PARA</option>"; if($id == "PB") $html.= "<option selected value='PB'>PARAIBA</option>"; else $html.="<option value='PB'>PARAIBA</option>"; if($id == "PR") $html.= "<option selected value='PR'>PARANA</option>"; else $html.="<option value='PR'>PARANA</option>"; if($id == "PE") $html.= "<option selected value='PE'>PERNAMBUCO</option>"; else $html.="<option value='PE'>PERNAMBUCO</option>"; if($id == "PI") $html.= "<option selected value='PI'>PIAUI</option>"; else $html.="<option value='PI'>PIAUI</option>"; if($id == "RJ") $html.= "<option selected value='RJ'>RIO DE JANEIRO</option>"; else $html.="<option value='RJ'>RIO DE JANEIRO</option>"; if($id == "RN") $html.= "<option selected value='RN'>RIO GRANDE DO NORTE</option>"; else $html.="<option value='RN'>RIO GRANDE DO NORTE</option>"; if($id == "RO") $html.= "<option selected value='RO'>RONDONIA</option>"; else $html.="<option value='RO'>RONDONIA</option>"; if($id == "RS") $html.= "<option selected value='RS'>RIO GRANDE DO SUL</option>"; else $html.="<option value='RS'>RIO GRANDE DO SUL</option>"; if($id == "RR") $html.= "<option selected value='RR'>RORAIMA</option>"; else $html.="<option value='RR'>RORAIMA</option>"; if($id == "SC") $html.= "<option selected value='SC'>SANTA CATARINA</option>"; else $html.="<option value='SC'>SANTA CATARINA</option>"; if($id == "SE") $html.= "<option selected value='SE'>SERGIPE</option>"; else $html.="<option value='SE'>SERGIPE</option>"; if($id == "SP") $html.= "<option selected value='SP'>SAO PAULO</option>"; else $html.="<option value='SP'>SAO PAULO</option>"; if($id == "TO") $html.= "<option selected value='TO'>TOCANTINS</option>"; else $html.="<option value='TO'>TOCANTINS</option>"; $html.="</select>"; echo $html; }